你如何强调html文本,以便文本下面的行是点缀而不是标准下划线?最好,我想这样做而不使用单独的CSS文件.我是html的新手.
Alf*_*ing 130
没有CSS,这是不可能的.实际上,<u>标签只是text-decoration:underline使用浏览器的内置CSS 添加到文本中.
这是你可以做的:
<html>
<head>
<!-- Other head stuff here, like title or meta -->
<style type="text/css">
u {
border-bottom: 1px dotted #000;
text-decoration: none;
}
</style>
</head>
<!-- Body, content here -->
</html>
Run Code Online (Sandbox Code Playgroud)
epa*_*llo 15
如果没有CSS,你基本上都不习惯使用图片标签.基本上制作文本图像并添加下划线.这基本上意味着您的页面对屏幕阅读器毫无用处.
使用CSS,它很简单.
HTML:
<u class="dotted">I like cheese</u>
Run Code Online (Sandbox Code Playgroud)
CSS:
u.dotted{
border-bottom: 1px dashed #999;
text-decoration: none;
}
Run Code Online (Sandbox Code Playgroud)
示例页面
<!DOCTYPE HTML>
<html>
<head>
<style>
u.dotted{
border-bottom: 1px dashed #999;
text-decoration: none;
}
</style>
</head>
<body>
<u class="dotted">I like cheese</u>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Sha*_*med 15
使用以下CSS代码......
text-decoration:underline;
text-decoration-style: dotted;
Run Code Online (Sandbox Code Playgroud)
也许我\xe2\x80\x99m有点晚了,但只需使用text-decoration: underline dotted,\nit\xe2\x80\x99s 一个可以在任何地方使用的CSS属性。
<u style="text-decoration:underline dotted">I have a dotted underline</u>Run Code Online (Sandbox Code Playgroud)\r\n对于虚线下划线,请使用text-decoration: underline dashed.
<u style="text-decoration:underline dashed">I have a dashed underline</u>Run Code Online (Sandbox Code Playgroud)\r\n正如 Darshana Gunawardana 所说,您可以使用text-underline-position: under, 在文本和行之间留出更多空间:
<u style="text-decoration:underline dotted;text-underline-position:under">I have a dotted underline</u>Run Code Online (Sandbox Code Playgroud)\r\nu {\n text-decoration: underline dotted;\n}\nRun Code Online (Sandbox Code Playgroud)\n
如果内容超过 1 行,添加底部边框将无济于事。在这种情况下你必须使用,
text-decoration: underline;
text-decoration-style: dotted;
Run Code Online (Sandbox Code Playgroud)
如果您希望文本和行之间有更多的喘息空间,只需使用,
text-underline-position: under;
Run Code Online (Sandbox Code Playgroud)
您可以利用text-decoration属性:
text-decoration: underline;
text-decoration-style: dotted;
text-decoration-line: underline;
text-decoration-thickness: 1px;
Run Code Online (Sandbox Code Playgroud)
小智 6
HTML5元素可以给出虚线下划线,因此下面的文本将具有虚线而不是常规下划线。当用户将光标悬停在元素上时,title属性会为用户创建工具提示:
注意:默认情况下,在Firefox和Opera中显示带虚线的边框/下划线,但是IE8,Safari和Chrome需要一行CSS:
<abbr title="Hyper Text Markup Language">HTML</abbr>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
115364 次 |
| 最近记录: |