Maverick Coder
Maverick Coder

Reputation: 35

formatting HTML paragraphs with CSS

I want to be able to highlight the text (paragraph) without it going across the entire page. Can someone help me confine this paragraph?

here is a link to a screen shot image showing the problem i am having: http://imageshack.us/photo/my-images/402/print1xs.png/

Heres my HTML code:

    <div id="content">

    <p> I like to play with pokemon <br>
        They are a fun way to relax
    <br>
        Go pokemon. 
    </p>
    </div>

Heres my CSS:

    #content{
    margin: 200px 0 0 73px;
    }

    #content p{
    font-size: 2em;
    }

Upvotes: 0

Views: 5420

Answers (3)

Adam
Adam

Reputation: 61

If you want to "highlight" the whole paragraph, set a background color for the paragraph. Also, to keep it from stretching the whole way across your div just change the paragraph width, like so:

.highlighted{background-color: #ffff00; width: 100px;}

Upvotes: 0

uday
uday

Reputation: 8710

Enter the following tag at the beginning of the highlighted text: <span style="background color: #FFFF99">. You can use any color you want, though this text highlights it in light yellow.

Upvotes: 0

Itay Moav -Malimovka
Itay Moav -Malimovka

Reputation: 53603

#content p{
    font-size: 2em;
    display: inline-block;
    background-color: magenta;
}

Upvotes: 1

Related Questions