1

I am trying to create a good heading for my fake webpage using the code:

<br>  
<h1>Adults For Kids</h1>  
<h2>Bring hope to those with none</h2>  
<br>  

but when this runs there is too much space around the text, and whenth the breaks are not there there is not enough blank space so how do you shorten a breaks line height in html?

2 Answers2

1
<br>  
<h1>Adults For Kids</h1>  
<h2>Bring hope to those with none</h2>  
<br>

Currently the <br> is not affecting the space between the <h1> and <h2>, it needs to be between the two elements so like this:-

<h1>Adults For Kids</h1>
<br>  
<h2>Bring hope to those with none</h2>

Or you can use padding example:-

<h1 style="padding-bottom:2px">Adults For Kids</h1>
<h2>Bring hope to those with none</h2>

There is padding-bottom, padding-top, padding-left, padding-right.

If you want space between <h1> and top of page you can do this:-

<h1 style="padding-bottom:2px; padding-top:5px">Adults For Kids</h1>
<h2>Bring hope to those with none</h2>
Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
0

As every tag of HTML comes with default properties of its own like margin and padding. You can use Meyer reset to set every thing to default.

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
 margin: 0;
 padding: 0;
 border: 0;
 font-size: 100%;
 font: inherit;
 vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
 display: block;
}
body {
 line-height: 1;
}
ol, ul {
 list-style: none;
}
blockquote, q {
 quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
 content: '';
 content: none;
}
table {
 border-collapse: collapse;
 border-spacing: 0;
}

Place this in your CSS code and every thing will be set to default like all the margin and paddings of the headings and paragraphs and line-heights of them. You should specify everything custom CSS.

Mohammed Wahed Khan
  • 836
  • 2
  • 14
  • 35