ThemeForest

CSS line-height problem

754 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Bought between 1 and 9 items
  • Europe
  • Referred between 500 and 999 users
lydian says

Hi Guys,

I’ve been trying to figure out how to remove the extra spacing css line-height property causing. If you look at the image below, you can see the extra space at the top of the text block. There is no extra spacing when I set the line-height to 0, so this is obviously related with the css line-height property. Anyone knows how to fix this issue properly?

Sample image

Posted 2 years ago Permalink
864 posts
  • Has been a member for 2-3 years
  • Helped protect Envato Marketplaces against copyright violations
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Bought between 10 and 49 items
  • France
  • Referred between 10 and 49 users
Pixelworkshop says

Hi, it happened to me with IE, a float:left fixed it

Posted 2 years ago Permalink
754 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Bought between 1 and 9 items
  • Europe
  • Referred between 500 and 999 users
lydian says
Hi, it happened to me with IE, a float:left fixed it

Just tried float: left but it didn’t work.

Posted 2 years ago Permalink
3495 posts
  • Has been a member for 3-4 years
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Interviewed on the Envato Notes blog
  • Envato Staff
  • Reviewer
  • Lead Reviewer
  • Community Moderator
  • Author had a Free File of the Month
  • Exclusive Author
  • Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Bought between 50 and 99 items
  • Venezuela
  • Referred between 1 and 9 users
Ivor says

Give us a link :) which browser is giving you the problem? all the browsers?

Posted 2 years ago Permalink
Ivor is an Envato staff member
174 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a File in an Envato Bundle
  • Exclusive Author
  • Bought between 1 and 9 items
  • Croatia
  • Referred between 1 and 9 users
mladenberakovic says

Can you provide a live demo? It will be much easier to help you then. :)

Posted 2 years ago Permalink
406 posts
  • Has been a member for 2-3 years
  • Grew a moustache for the Envato Movember competition
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 1 and 9 items
  • Portugal
  • Referred between 10 and 49 users
unisphere says

Check if your p tags have margin or padding top

Posted 2 years ago Permalink
754 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Bought between 1 and 9 items
  • Europe
  • Referred between 500 and 999 users
lydian says

Alright guys, here is the link as requested http://www.flashyfiles.com/test/test.html

Posted 2 years ago Permalink
406 posts
  • Has been a member for 2-3 years
  • Grew a moustache for the Envato Movember competition
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 1 and 9 items
  • Portugal
  • Referred between 10 and 49 users
unisphere says

It’s a bit of a hack but try this in your css:

.preview_text p {
font-size:12px;
line-height:23px;
margin-bottom:20px;
margin-top:-7px;
}
Posted 2 years ago Permalink
3495 posts
  • Has been a member for 3-4 years
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Interviewed on the Envato Notes blog
  • Envato Staff
  • Reviewer
  • Lead Reviewer
  • Community Moderator
  • Author had a Free File of the Month
  • Exclusive Author
  • Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Bought between 50 and 99 items
  • Venezuela
  • Referred between 1 and 9 users
Ivor says
It’s a bit of a hack but try this in your css:
.preview_text p {
font-size:12px;
line-height:23px;
margin-bottom:20px;
margin-top:-7px;
}

I thought that too, giving a margin-top:-5px but is not correct it can mess up things later, I think that the best solution here is to add padding to your image.

.post_image img {padding:5px;}

that’s how line-height works, so is not a bug or something similar – http://grab.by/38To

Posted 2 years ago Permalink
Ivor is an Envato staff member
862 posts
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Philippines
  • Referred between 100 and 199 users
mabuc says

you can put margins in your image divs.

Posted 2 years ago Permalink
by
by
by
by
by