SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Location
    New York
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Question] XHTML 1.0 Strict

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Staten Island - Places</title>
    </head>
    
    <body>
    <div id="holder"><div id="toc">
    Tonys Store
    <br />Jade Richard's House
    <br />White Castle's Restaurant
    </div>
    <div id="psi">
    <h1>Places located within Staten Island</h1>
    <p>Staten Island doesnt have alot of places that I persoanlly like to visit often
    <br />
    Below is a list that I have created showcasing some of my favorite places(in no special order)</p>
    <ul>
    <li title="Store">Tonys Store(Corner of Broad St &amp; Gordon St)</li>
    <li>Jade Richard's House(My Girlfriend)</li>
    <li>White Castle's Restaurant(Bay St)</li>
    </ul>
    </div>
    <div id="reason">
    <h2>Reasons Why</h2>
    <p>Tonys store - Because they make the best sandwiches. Honey Turkey and cheese grilled with everything on it.
    <br />Jade Richard's House - Because she is my girlfriend and I love her so much.
    <br />White Castle's Restaurant - Because late at night its just about the only place to get some food.</p>
    </div></div><p>
    <img src="http://www.sessions.edu/images/newLogo.gif" alt="New Logo from Sessions.edu" title="Logo I stole from Sessons.edu"/></p>
    </body>
    </html>

    The code validates to XHTML 1.0 Strict standards but I have a question.


    <p><img src="http://www.sessions.edu/images/newLogo.gif" alt="New Logo from Sessions.edu" title="Logo I stole from Sessons.edu"/></p>


    The image must be within an element. So is <p> the proper one to use? Or does it really matter. The code wont validate without it being within an element.

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Location
    New York
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just started learning XHTML acouple of days ago and decided to try some a little page using what I know so far.

    Books

    Sitepoints XHTML and CSS the right way : Ian Lloyd(paperback)
    HTML, XHTML , and CSS SIXTH EDITION : Elizabeth Castro (PDF file ebook)

    I prefer Elizabeth Castro because it covers alot more and Ive noticed Ian's book leaves out alot of stuff a newbie like myself should know.

    Ian's is also kinda like a big tutorial. Which I do not like.(Im only upto I think chapter 5 though but have switched over to Elizabeth Castros book.)

    For CSS though I think im gonna use Ian's book though because it seems better for me.

    For coding I use Dreamweaver 8 in CODE VIEW.
    Ive noticed when you preview the code in design view its sometimes different from what IE7 displays so just a heads up if something aint appearing right.

    I also DO NOT recommend validating your code in Dreamweaver. Go straight to the W3 site for this.

  3. #3
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some people would probably use a <p> while others would choose a <div>.

    The following code looks like it might be a list and if so, should be marked up as one.
    Code:
    <div id="toc">
    Tonys Store
    <br />Jade Richard's House
    <br />White Castle's Restaurant
    </div>
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by reldapimp View Post
    The code validates to XHTML 1.0 Strict standards
    That really doesn't mean anything, does it, since you seem to serve it as text/html. That means it will be used as HTML, so whether or not it 'validates as XHTML' is rather irrelevant.
    (And it is invalid HTML, since the NET syntax of the META element means there'll be character data in the HEAD section.)

    Quote Originally Posted by reldapimp View Post
    The image must be within an element. So is <p> the proper one to use? Or does it really matter. The code wont validate without it being within an element.
    In a strict DTD (HTML 4.01 Strict, XHTML 1.0 Strict or XHTML 1.1), the BODY element may only contain block-level elements. IMG is inline.

    You can wrap the IMG insida a P if the text equivalent (the ALT text) can be regarded as a paragraph of text. In this case, it can. If the ALT text is not a paragraph, you could use a semantically neutral block-level element: DIV.
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

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