【问题标题】:HTML title appears in italics for unknown reasonsHTML 标题以斜体显示,原因不明
【发布时间】:2016-11-02 23:41:45
【问题描述】:

我页面上的标题一直以斜体显示,我找不到任何代码表明它应该这样做。会发生什么?我什至从另一个页面复制/粘贴了标题代码,其中标题没有斜体,但它仍然存在。

    <head>
<title>1867 Settlement - Origins</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
    background-color: #E6E6FA;
}
.style2 {
    font-size: small;
    font-style: italic;
}
.style3 {font-size: small}
a:link {
    color: #B2243B;
}
a:visited {
    color: #B2243B;
}
-->
</style>
</head>

【问题讨论】:

  • 这里的“title”到底是什么意思?您的代码行中显示的&lt;title&gt; 标记not 显示在网页上。它只是元信息,主要用于搜索机器人。一些浏览器还会在窗口顶部栏中显示它。但是网页本身的可见标题必须在标记的&lt;body&gt; 部分中。
  • 通过标题,我的意思是标题听起来像:一些文本出现在我的页面顶部,并带有页面名称。实际标题周围的代码与斜体字体无关。整个网页中唯一 的内容是我刚刚从 发布的关于斜体的内容,但只有标题本身以斜体显示。其余的文字是常规的。
  • 嗯,必须有一些规则,浏览器本身不会这样做。右键单击元素并期待它。

标签: html title italics


【解决方案1】:

如果你想使用 content 属性很容易地设置标题属性的样式

a[title]:hover:after {
 content: attr(title);
 padding: 4px 8px;
 color: #333;
 position: absolute;
 left: 0;
 top: 100%;
 z-index: 20;
 white-space: nowrap;
 -moz-border-radius: 5px;
 -webkit-border-radius: 5px;
 border-radius: 5px;
 -moz-box-shadow: 0px 0px 4px #222;
 -webkit-box-shadow: 0px 0px 4px #222;
 box-shadow: 0px 0px 4px #222;
 background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
 background-image: -webkit-gradient(linear,left top,left    bottom,color-stop(0, #eeeeee),color-stop(1, #cccccc));
 background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
 background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
 background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
 background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
  }

演示http://jsfiddle.net/tDQWN/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-30
    • 1970-01-01
    • 2018-06-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多