在句子上应用不同的颜色

时间:2015-09-16 06:50:51

标签: html css

我在html中有句子。我想在同一行的某些文本上设置一个特定的颜色,彼此相邻[关闭]。我试着用“p style = color:red”标签。但它显示颜色用下一行改变。我想在同一行内查看。请帮助我成功地做到这一点......

谢谢

<table>
<tr>        
<td colspan="2">Your registration has been accepted.Site has send a 
<p style=color:red>Verification Link </p>on your Email ID.Please click on the hyperlink in the Confirmation Email to confirm your Email ID.Your registration have been in effect upon receiving your confirmation reply.</td>
</tr>
</table>

结果:

  

您的注册已被接受.Site已发送

     

验证链接

     

在您的电子邮件ID上。请单击确认电子邮件中的超链接以确认您的电子邮件ID。您的注册已在收到确认回复后生效。

我想将其显示为一行

  

您的注册已被接受.Site已在您的电子邮件ID上发送验证链接。请单击确认电子邮件中的超链接以确认您的电子邮件ID。您的注册已在收到确认回复后生效。

3 个答案:

答案 0 :(得分:2)

你的造型表达方式遗漏了" " 除此之外,如果您想“在同一行内查看”,请使用span

<span style="color:red;">Verification Link</span>

但仍然不是最好的方法。你一定要阅读 CSS

CSS方式做到这一点,正确的方法:

<html>
<head>
    <style type="text/css">
        .verification { color: red; }
    </style>
</head>
<body>
    <p>Only the <span class="verification">verification class</span> example.</p>
</body>
<html>

答案 1 :(得分:2)

你必须使用

<span style="color:red;">Verification Link</span>

代替p-Tag&amp;我会否认所有内联css btw。

答案 2 :(得分:1)

你的风格周围应该有引号。你也应该用分号结束每个样式(在这种情况下你只有一个,所以只用一个结尾)。

<span style="color: red;">Verification Link</span>