Greg
Greg

Reputation: 3063

Can't get rid of extra space between 2 lines

For some reason I can't reduce the "empty" space between 2 lines (see picture and this link for live demo ). I've tried many things (line-height, margin top and bottom, padding, etc.) but without success. This one, for some reason is tricky. I tried to reproduce the issue on JSFiddle without success.

Edit: I have now removed the <br> between the 2 pairs of p tags but it created a new issue: both lines (both pair of p tags) are now displayed as one single line

displaying the error in the image

CSS code from css/mettile.css

.tile-five {
    width: 400px;
    height: 46px;
    display: block;  
    margin-right: 0px;
    border-radius: 20px; 
    -moz-border-radius: 20px; 
    -webkit-border-radius: 20px;
}


.tile-five:hover {
    outline: solid 4px #dadada;
}

.tile-five-small {
    width: 180px;
    height: 180px;
    display: block;
}

.tile-five-small:hover {
    outline: solid 4px #dadada;
}

.tile-five-text-area {
    width: 100%;
    height: 100%;
    background-color: #f2F2F2;
    padding-left: 12px;

}

.tile-five-text-area label {
    color: white;
    font-size: 25px;
    line-height: 13px;
    text-align: left;
    float: left;
}

.tile-five-text-area p {
    color: #333;
    font-size: 13px;
    padding-top: 5px;
    margin: 8px 5px 5px 5px;
    text-align: left;
    float: left;
}

HTML

<div id="sub-header">
        <div class="sub-header-wrapper">
          <div class="left">
            <h1>LOREM IPSUM</h1>
            <h2>Votre dfds dfdsf dsfds (dfds fds) à Luiotkjkjkjy</h2>
          </div>
          <!-- End Left -->
          <div class="right"><a id="MetTileFive" class="tile-five" href="http://www.facebook.com/" target="_blank">
            <div>
            <p><strong>Actualité</strong></p>
            <br>
            <p>Découvrez <strong>Ladkkiu</strong>, un concept unique au Luiotsddqsdykjkjkj</p>
          </div>
            <div>
            <p><strong>Actualité</strong></p>
            <br>
            <p>Atelier dfdsf à Luioty le 03 Mars 2014. Réservez vite!</p>
          </div>
            </a></div>
          <!-- End Right --> 
        </div>
        <!-- End Wrapper --> 

      </div>
      <!-- End sub-header-->

Upvotes: 1

Views: 4193

Answers (4)

Rohit Maharashi
Rohit Maharashi

Reputation: 71

Don't use two separate p tags rather try writing with a single p tag

<div>
            <p><strong>Actualité</strong>
            <br />
            Découvrez <strong>Ladkkiu</strong>, un concept unique au Luiotsddqsdykjkjkj</p>
</div>

Elements like p and h1 are block elements and hence insert some space between consecutive lines.

Upvotes: 0

vahid kargar
vahid kargar

Reputation: 794

The "empty" space between 2 lines can be reduced with:

#sub-header .right {
    float: right;
    padding-right: 20px;
    line-height: 4px;
    }

or

#sub-header p {
line-height: 1px;
}

Upvotes: 2

user2203117
user2203117

Reputation:

To do this there is a special property in css called line-height you can set it to 1em to reduce height.more info. And remember only use em or pixels. why? .
This way it is possible to control the vertical distance as you wish.

Upvotes: 1

wmfrancia
wmfrancia

Reputation: 1246

Remove the < br > between your < p > tags, as that creates the blank space between your lines.

if the code looks like this you should be fine, I just looked at it in chrome and the lines of text were on two lines not one.

<div class="tile-five-text-area">
        <p><strong>Actualité</strong></p>

        <p>Découvrez <strong>Ladkkiu</strong>, un concept unique au Luiotsddqsdykjkjkj</p>
</div>

Upvotes: 0

Related Questions