csehz
asked on
CSS - Absolute 0 margin for texts
Dear Experts,
Could you please have a look on the below attached picture, applying this CSS code so having both margin 0 and padding 0 for the text, there can be seen a small place above of it in the browser.
Could you advise is that normal like that or something is needed for the "absolute 0 margin"?
thanks,
Could you please have a look on the below attached picture, applying this CSS code so having both margin 0 and padding 0 for the text, there can be seen a small place above of it in the browser.
<!doctype html>
<html>
<head>
<style>
body { margin: 0px; background: #eee; }
#box { width:150px; height: 150px; background:#aaa; }
p { margin: 0; padding: 0; }
</style>
</head>
<body>
<div id="box">
<p>Test text</p>
</div>
</body>
</html>
Could you advise is that normal like that or something is needed for the "absolute 0 margin"?
thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yes. line height is the space between lines. If you don't want to decrease the line height, and you really want to raise the text all the way to the top, you could also try giving the box or the p element a negative margin-top. I'm not sure if any of that is worth it though.
ASKER