CSS多个div样式

时间:2015-09-19 14:32:55

标签: html css

我正在尝试使用此行设置紫色标题并加下划线:

<div style="color:purple ; style=text-decoration:underline"><h1>Welcome to the SuperCar Web Site</h1></div>

这让我只回到紫色,我试着用它来做 - this - 教程,我试过这行:

<DIV style="color:red; font-style:italic">I'm some red-hot italic text!</DIV>

我的问题是什么?

3 个答案:

答案 0 :(得分:1)

您在style属性中使用了另一个样式声明。如果再次查看炽热的斜体代码,可以看到如何正确使用样式属性。你的代码应该是这样的:

<div style="color: purple; text-decoration: underline;"><h1>Welcome to the SuperCar Web Site</h1></div>

PS:你不需要div元素来标题你的标题。您也可以在h1标签中使用样式声明。

<h1 style="color: purple; text-decoration: underline;">Welcome to the SuperCar Web Site</h1>

答案 1 :(得分:0)

在文本修饰之前不需要再使用样式 <div style="color: purple; text-decoration: underline;"><h1>Welcome to the SuperCar Web Site</h1></div>

答案 2 :(得分:-1)

你的内联式

语法错误了

<div style="color:purple; text-decoration:underline"><h1>Welcome to the SuperCar Web Site</h1></div>

删除“内部”风格