Click to See Complete Forum and Search --> : Change to Heading spacing
dgittoes
05-27-2003, 06:42 PM
Hi there
Does anyone know of a way to override to spacing that H1 - H6 puts around text?
In other words I want to be able to code
<H4>This is a heading</H4>
This is a paragraph.
and have it render as
This is a heading
This is a paragraph
as opposed to rendering as
This is a heading
This is a paragraph
Is this possible?
I believe it is the line-height (http://www.w3.org/TR/CSS2/visudet.html#propdef-line-height) property.
Jona
Charles
05-28-2003, 06:26 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Style-Type" content="text/css">
<title>Example</title>
<h1 style="margin-bottom:0em">Example</h1>
<p style="margin-top:0em">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
Nevermore
05-28-2003, 07:05 AM
I thought you used display:inline; because it is a block level element and you want it to render as an inline element.
Robert Wellock
05-28-2003, 12:45 PM
Yes, you could use it inline though the headings have "semantic value and meaning" and were specifically designed to be block level elements that is why Charles rightly chose margin as the most appropriate solution to the problem.
Nevermore
05-28-2003, 12:47 PM
Then I am enlightened. At least more than I was, anyway.
Robert Wellock
05-28-2003, 12:54 PM
I am glad you could follow the reasoning, to understand correct usage of CSS, sometimes you have to look at bare HTML structure from a semantic stance :D.
nkaisare
05-28-2003, 03:21 PM
Does:
h4+p{margin-top: 0}
work in IE6/Win and IE5/Mac?
Robert Wellock
05-30-2003, 09:17 AM
It does not seem to work on M$ IE 6.0 for Windows.