Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

6. Standards, Compliance, and all that J... > Fixing the nesting problem

Fixing the nesting problem

So it looks like strict HTML 4.01 prefers that images, which are inline elements, be nested inside a block element, like a paragraph or a heading. That’s a simple change to make. Open your “lounge.html” file and add a <p> element around the <img> element.

image with no caption

Once you’ve done that, save and reload the page in your browser. You’ll see it doesn’t really affect the look of the page. Why? Because the heading above the image and the paragraph below are already block elements with linebreaks below and above them, respectively. So the <p> element around the image doesn’t actually add any new linebreaks or spacing.

image with no caption

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint