CSS Margins Increase with H1 Length
Posted
by Ethan Turkeltaub
on Stack Overflow
See other posts from Stack Overflow
or by Ethan Turkeltaub
Published on 2010-03-21T17:50:35Z
Indexed on
2010/03/21
17:51 UTC
Read the original article
Hit count: 519
Consider the following markup:
<!DOCTYPE html>
<html>
<head>
<title>Test Page</title>
<link href="screen.css" rel="stylesheet" />
</head>
<body>
<h1>Test</h1>
<h3>Description</h3>
</body>
</html>
And the CSS:
h3{
margin-top: -25px;
}
Now, I want the H3 to have a margin-left of however long H1 is, and it is consistently 20px away. So, if I have a H1 block of 200px long, then H3 would have a margin-left of 220px, and so on and so forth. How would I do this?
© Stack Overflow or respective owner