代码之家  ›  专栏  ›  技术社区  ›  Some Random Awesome Guy

如何在html中缩短换行符的高度?

  •  1
  • Some Random Awesome Guy  · 技术社区  · 7 年前

    我正试图使用以下代码为我的假网页创建一个好标题:

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

    2 回复  |  直到 7 年前
        1
  •  1
  •   Peter Haddad    7 年前
    <br>  
    <h1>Adults For Kids</h1>  
    <h2>Bring hope to those with none</h2>  
    <br>
    

    目前 <br> 不会影响 <h1> <h2>

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

    或者你可以使用 padding

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

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

    如果你想在 <

    <h1 style="padding-bottom:2px; padding-top:5px">Adults For Kids</h1>
    <h2>Bring hope to those with none</h2>
    
        2
  •  0
  •   Mohammed Wahed Khan Michael    7 年前

    您可以使用Meyer reset将所有内容设置为默认值。

    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;
    }

    将其放入CSS代码中,所有内容都将设置为默认值,就像标题和段落的所有边距和填充以及它们的行高一样。您应该指定自定义CSS的所有内容。