开发者

HTML Coloring Help?

I really need help :) I have to put multiple words in a line, each with开发者_开发百科 a different color, I tried wrapping each word in a <div> </div> and styling, but it seems it makes a new line between words.


Try using <span>.

<div>s are used for block-level elements. <span> is used for inline elements, such as text enclosed in a <p> element.

Further reading: Span and div


That's because <div> is a block element. Try <span> (an inline element) instead.


Use a Span tag instead, like

This <span style="color:red;">text</span> is red, but <span style="color:blue;">THIS</span> text is blue!


<div> is a block-level element. This means you either need to apply a display: inline style to it or better yet, use an inline tag such as <span>


use <span>Text Here</span> And style it in your css.


Use <span> </span> It is what it is mean to.

Then you can set css classes.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
   <head>
       <title>My web</title>
       <style type="text/css">
           yellow {
           color: yellow;
 }
        </style>
   </head>

   <body>

        Span is not at the <span class="yellow">yellow level</span>. 
   </body>
</html>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜