Hi,

No matter what I try


<style>
.FlexColumn {display: flex;flex-flow: column nowrap }
</style>

<div class="FlexColumn">
	<div>X</div>
	<div>X</div>
	<div>X</div>
	<div>X</div>
	<div>X</div>
</div>
<!-- I tried many CSS trick here... -->
<div>
   <span>X</span><br><span>X</span><br><span>X</span><br><span>X</span>
</div>

I always get a vertical gap between the characters !

Any ideas ?

Thanks.

  • Thorry84@feddit.nl
    link
    fedilink
    arrow-up
    21
    ·
    5 months ago

    line-height is the property you are looking for. Beware fucking with line-height is usually a bad idea, as characters can extend below or above the “line” and will collide.

    Also maybe look at divitis, you might be suffering from it.

    • dohpaz42@lemmy.world
      link
      fedilink
      English
      arrow-up
      6
      ·
      5 months ago

      👆 Sometimes the best solution is to just let it be. It’s better to adapt your design to fit the technology, than it is to fit the technology to your design.

  • SpongeB0B@programming.devOP
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    5 months ago

    ok I’ve found a work around

    <style>
    .FlexColumn {display: flex;flex-flow: column nowrap }
    .FlexColumn > div {display: inline-block; margin: -4px 0}
    </style>
    
    <div class="FlexColumn">
    	<div>X</div>
    	<div>X</div>
    	<div>X</div>
    	<div>X</div>
    	<div>X</div>
    </div>
    

    But if someone have something more proper, I’m all ears.

    • dohpaz42@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      ·
      5 months ago

      My two cents: if you have to resort to negative numbers, it’s time to rethink things. It may work, but it’s kludgy and most likely not easily scalable. Take the extra effort and find the better (more correct) way to manage this issue. Not only will it be correct, and scalable, but I’m sure you’ll learn a lot along the way. It really is a win-win when you take your time. 😊

  • aqwsedrf@lemmynsfw.com
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    5 months ago

    maybe the line-height property is the thing you are looking for.

    .FlexColumn {display: flex;flex-flow: column nowrap; line-height: 0.7 }

  • lud@lemm.ee
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    5 months ago

    Why not just a single span or paragraph with <br>?

  • Treczoks@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    5 months ago

    Removing the leading is possible with some tricks, but it is not recommendable, as it has it’s issues. Maybe you could tell us what you actually want to accomplish? Assuming that you are not stacking X’s for fun and entertainment…

  • trustnoone@lemmy.sdf.org
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    Sorry if this is a silly answer as i don’t kbow css well, but have you removed the inherent styling that comes with the browser. I think you need to have a

    * {magin: 0; padding: 0}