<h1> spacing

R

richard

<center><h1>sample</h1></center>
<center><h2>text</h2><h3>line 2</h3></center>
<center><h3>line 3</h3></center>
<center>
blah blah<br>
yada yada<br>
</center>


Given this short example of code, how does one go about eliminating
the extraneous space left between the <h(n)> tags?
So that "line 2" would appear directly under "text" as any natural
line would.
 
A

asdf

richard said:
<center><h1>sample</h1></center>
<center><h2>text</h2><h3>line 2</h3></center>
<center><h3>line 3</h3></center>
<center>
blah blah<br>
yada yada<br>
</center>


Given this short example of code, how does one go about eliminating
the extraneous space left between the <h(n)> tags?
So that "line 2" would appear directly under "text" as any natural
line would.

css:

h1, h2, h3, h4, h5, h6 {
padding: 0;
margin: 0;
}

Of course, one wouldn't do this if one was following the credo of semantic
markup.

Headings have nothing to do with appearance, and everything to do with
logical document structure.
 
D

dorayme

richard said:
<center><h1>sample</h1></center>
<center><h2>text</h2><h3>line 2</h3></center>
<center><h3>line 3</h3></center>
<center>
blah blah<br>
yada yada<br>
</center>


Given this short example of code, how does one go about eliminating
the extraneous space left between the <h(n)> tags?
So that "line 2" would appear directly under "text" as any natural
line would.

You would not use center because you would control the problem
you are concerned with by specifying padding and margins for your
heading elements, especially the top and bottom margins, and
while at it would do the job of centering the headings (if they
are short headings, text-align: center will do).
 
R

richard

<center><h1>sample</h1></center>
<center><h2>text</h2><h3>line 2</h3></center>
<center><h3>line 3</h3></center>
<center>
blah blah<br>
yada yada<br>
</center>


Given this short example of code, how does one go about eliminating
the extraneous space left between the <h(n)> tags?
So that "line 2" would appear directly under "text" as any natural
line would.

Just to see what would happen, I included a <span
style="font-size:75%;"> tag and it appears to do what I want quite
well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top