簡體   English   中英

CSS字體大小重置

[英]CSS Font-Size Reset

我只是想知道是否有任何CSS字體大小重置代碼,因為我正在做一個沒有浮點數的網格,不得不將字體大小設置為0

結果,該Div內的所有Text均未顯示。

謝謝您的幫助!

編輯:

JSFiddle

在不將font-size設置為0的情況下進行Grid的某些方法也很不錯。

這是我正在使用的簡化標記和CSS:

的HTML

<div class="container">

    <div class="inner">

        <section id="left-area"> [...] </section>

        <section id="right-area"> [...] </section>

    </div>

</div>

的CSS

.container {
    margin: 0 auto;
    text-align: left;
    width: 1020px;
}

.container .inner {
    width: 100%;
    height: 100%;
    display: table-row;
    font-size: 0;
}

.container .inner section#left-area, .container .inner section#right-area {
    display: inline-block;
    vertical-align: top;
}

使用Eric Meyer CSS重置。

這是代碼:

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

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

有很多重置,但是就像您說的那樣,您需要特定於字體的重置,但是這種重置在整體上使用時,對我的很多項目都有所幫助,包括字體大小,當完全使用時,將滿足您的字體大小也有要求。 希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM