www.webdeveloper.com
Results 1 to 4 of 4

Thread: Color code of first p element in div

  1. #1
    Join Date
    Jan 2009
    Posts
    3

    Color code of first p element in div

    Hi Folks, Some food for thought. I recently took an exam on Web Development fundamentals and here is a question that Im having a tough time with. Id greatly appreciate your inputs on this question.
    Best Regards.

    <div id="myitem">
    *<h1>Sample Header</h1>
    *<p>Sample paragraph 1</p>
    *<p>Sample paragraph 2</p>
    *<p>Sample paragraph 3</p>
    </div>

    Which one of the following changes the text color of only "sample paragraph 1" in the sample code above?
    Choice 1 : h1:before p {
    * color: blue;
    }
    Choice 2 : h1 > p {
    * color: blue;
    }
    Choice 3: h1 p:first {
    * color: blue;
    }
    Choice 4: h1 + p {
    * color: blue;
    }
    Choice 5: h1 p {
    * color: blue;
    }

  2. #2
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,478
    Hi there JerryTom,

    and a warm welcome to these forums.

    Choice 4 - ( the adjacent sibling selector ) is the correct answer.

    Of course, you must bear in mind that IE6 will not be able to implement it.
    So nothing new there then.

    Further reading:-

    coothead
    Last edited by coothead; 01-06-2009 at 03:49 AM.

  3. #3
    Join Date
    Jan 2009
    Posts
    3
    Many Thanks, CootHead!!! Appreciate it!!!

  4. #4
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,478
    No problem, you're welcome.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles