html - 粗体和斜体在 Firefox 或 Chrome 中不起作用

标签 html css

粗体 <b></b>和斜体 <i></i>标记在 iPhone 和 Internet Explorer 上正确呈现,但在 Firefox 或 Chrome 中没有格式。

这是 .css 文件。我还尝试添加 i { font-style:italic; }分别在重置和样式中。

Color.css:

body {
    color: #fff;
    background-image: url(../img/background-red.png);
}

Reset.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,
input, textarea, button
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, dl {
    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;
}


Style.css:

html, body {
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;  

    font: normal 18px/1.4 'Open Sans', Arial, Helvetica, sans-serif;

    background-position: left top;
    background-repeat: no-repeat;
}

.panel {
    position: absolute;
    z-index: 0;
    background: #fff;

    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    filter: alpha(opacity=0);
    opacity: 0;

    -moz-box-shadow: 0 0 10px #fff;
    -webkit-box-shadow: 0 0 10px #fff;
    box-shadow: 0 0 10px #fff;
}


.content {
    max-width: 45%;
    margin: 100px;

    float: left;

    position: relative;
    z-index: 1;    
}

h1 {
    font-size: 72px;
    line-height: 56px;
    font-weight: 300;    
}

h2 {
    margin: 15px 0 50px;    

    font-size: 30px;
    line-height: 30px;    
    font-weight: 300;    
}

这是 HTML,我尝试使用 <strong>asdf</strong>看看它是否会使文本变为粗体,但事实并非如此。

<div class="content">
    <h1>adssda</h1>
    <h2>dasdasdsa</h2>

<p><i><strong>sadsad</strong>asdsad</i></p><br>
sadasddsa<br><br>
<strong>asdasd</strong><br><br>
    <p><strong>asdasd</strong></p><br>
</div>

为什么粗体文本看起来和普通文本一样?

最佳答案

Firefox 无法处理某些标签,例如 <b> , <strong><i>出于某种原因的标签。这是 firefox 浏览器本身的一个错误。尝试不同版本的 firefox,情况就会有所不同。

这是适用于所有人的解决方法,将其添加到您的 CSS 文件中:

strong, b {
    font-weight: bold;
}

这是一个 CSS 覆盖。现在 firefox 呈现粗体文本like this 而不是 like this。

关于html - 粗体和斜体在 Firefox 或 Chrome 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15491364/

相关文章:

jquery - 用于 fontawesome 的append() 或appendTo()

python - 如何使用 pylint 1.8.2 生成 html 报告以在 gitlab-ci 页面中发布?

CSS 偏斜问题 - 尽管添加了相反的偏斜,但子元素仍偏斜

css - 将样式应用于父元素和子元素

php - HTML 表单提交仅偶尔注册点击 - 为什么?

javascript - 如何在分离的 JavaScript 中使用 jsp 变量?

javascript - 如何将页面部分锚定到滚动条上出现的导航栏的底部?

javascript - Bootstrap 模态框不会启动

html - 用多个列表元素填充水平列表

css - 需要在输入中获取一个值 id