将每个单词的第一个 H1 字母放大并为单个 H1 着色
我有一个包含 5 个单词的 h1 行,我只想增加第三个、第四个和第五个首字母的大小,给它们添加下划线,然后将它们设置为不同的颜色。
我已经完成了,但是 WC3 说我的代码对于大小、下划线和颜色的每种情况下的所有属性和元素都无效。
以下是在浏览器中有效但无法验证的内容:
欢迎使用
M< /u>y <字体大小=120% 颜色=红色>Fvourite Website
这是我唯一的错误(总共 15 个)在这个设计上。
请任何人协助使用 HTML 和/或 CSS 来修复此问题,以便其验证。
我尝试过尺寸和颜色的变化,虽然它们在浏览器中工作,但它们不会验证。
谢谢 :)
I've got a h1 line of 5 words and I want to increase the size of the 3rd, 4th and 5th initial letters only, underline them and then make them a different color.
I've done it but WC3 says my code is invalid on all attributes and elements in each case of size, underlining and color.
Here's what works in the browsers but won't validate:
<p><h1>Welcome to <br /><font size="120%" color=Red><u>M</u></font>y <font size=120% color=Red><u>F</u></font>vourite
<font size=120% color=Red><u>W</u></font>ebsite</h1></p>
It's giving me my only errors (15 in all) on this design.
Please can anyone assist with the HTML and or CSS to fix this so that it validates.
I have tried variations for size and color and though they work in the browsers, they will not validate.
Thank you :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
它们不会验证,因为字体标签很久以前就被弃用了,因此它的所有参数都被弃用了,
您可以在CSS中使用它:
并将要突出显示的单词包装在span标签中:
应用于您的代码:
演示:
http://jsfiddle.net/Mutant_Tractor/SBbcu/
They won't validate cause the font tag was deprecated long ago, and thus all of its parameters,
You can use this in CSS:
And wrap the word to be highlighted in span tags:
Applied to your code:
Demo:
http://jsfiddle.net/Mutant_Tractor/SBbcu/
已弃用。使用应用了 CSS 的
。
are deprecated. Use a
<span></span>
with CSS applied to it.使用带有
style
属性的span
元素,如下所示:或者,为各种组合定义 CSS 类并使用它们。
Use a
span
element with astyle
attribute, as in:Alternatively, define CSS classes for the various combinations and use those instead.
因此,作为摘要
中
或
使用“纯”HTML/CSS,您有多种可能性来实现您的目标正在追赶。这是几个变化。您可能应该将
class
属性添加到span
元素,但为了简洁起见,我在这里省略了它们。1°
HTML 文件:
CSS 文件:
2°
HTML 文件:
CSS 文件:
So, as a summary
<font>
or<u>
With "pure" HTML/CSS you have multiple possibilities to achieve what you're after. Here are couple variations. You probably should add
class
attributes tospan
elements but I've omitted them here for brevity.1°
HTML file:
CSS file:
2°
HTML file:
CSS file:
您有一些无效标签
和
。
我会做这样的事情来验证和清理你的代码:
甚至:
You have some invalid tags
<font>
and<u>
.I would do something like this to validate and clean up your code:
or even: