www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > HTML

    HTML Discussion and technical support for building, using and deploying HTML sites.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 06-04-2007, 03:23 AM
    toplisek toplisek is offline
    Registered User
     
    Join Date: Sep 2005
    Posts: 1,281
    Question How to do correct tag within tag <p>?

    I have validated code and found that there are some mistakes after validation:
    PHP Code:
    <p>My address<br />
          
    My text1<br />
          
    NY25689</p>
    How to do correct next line because it gives me error that </p> was not found even I put at the end </p>
    Reply With Quote
      #2  
    Old 06-04-2007, 03:29 AM
    creedo creedo is offline
    fil_w_d
     
    Join Date: Sep 2006
    Location: phil
    Posts: 64
    <p>My address</p>
    <p> My text1</p>
    <p> NY25689 </p>

    it will automatically break it..no need for <br /> or if you really want it you can make something like this.

    <p>My address</p>
    <br />
    <p> My text1</p>
    <br />
    <p> NY25689 </p>
    __________________
    My mother's menu consisted of two choices: Take it or leave it.
    Reply With Quote
      #3  
    Old 06-04-2007, 03:33 AM
    toplisek toplisek is offline
    Registered User
     
    Join Date: Sep 2005
    Posts: 1,281
    I have problem that p means paragraph. So, it is space between p tags and It should be My text1 within p. In other case it will be too much space.

    There is also error when I put:
    <p >&nbsp;</p>

    Is this wrong space when I implement validation?

    Last edited by toplisek; 06-04-2007 at 03:59 AM.
    Reply With Quote
      #4  
    Old 06-04-2007, 04:04 AM
    toplisek toplisek is offline
    Registered User
     
    Join Date: Sep 2005
    Posts: 1,281
    I have at the top xhtml:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    Reply With Quote
      #5  
    Old 06-04-2007, 05:25 AM
    Charles's Avatar
    Charles Charles is offline
    JavaScript Banned
     
    Join Date: Nov 2002
    Location: Baltimore, Maryland
    Posts: 11,730
    You've something else going on there. Please post the URL.
    __________________
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web
    Reply With Quote
      #6  
    Old 06-04-2007, 05:27 AM
    toplisek toplisek is offline
    Registered User
     
    Join Date: Sep 2005
    Posts: 1,281
    Sorry URL is not there as it is testing
    Reply With Quote
      #7  
    Old 06-04-2007, 05:31 AM
    Charles's Avatar
    Charles Charles is offline
    JavaScript Banned
     
    Join Date: Nov 2002
    Location: Baltimore, Maryland
    Posts: 11,730
    I'm sorry then. Everything that you have posted is valid as it appears.
    __________________
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web
    Reply With Quote
      #8  
    Old 06-04-2007, 09:56 AM
    kiwibrit kiwibrit is offline
    Registered User
     
    Join Date: Jun 2005
    Location: United Kingdom
    Posts: 929
    Quote:
    Originally Posted by toplisek
    Sorry URL is not there as it is testing
    You might want to consider loading the test page, unlinked to the main site, and disallowed by robots.txt to most search engines, if you want us to look at it.
    Reply With Quote
      #9  
    Old 06-04-2007, 01:01 PM
    WebJoel's Avatar
    WebJoel WebJoel is offline
    Super Moderator
     
    Join Date: Dec 2005
    Location: American, living in Toronto, ON. CANADA
    Posts: 6,668
    Quote:
    Originally Posted by toplisek
    I have problem that p means paragraph. So, it is space between p tags and It should be My text1 within p. In other case it will be too much space.

    There is also error when I put:
    <p >&nbsp;</p>

    Is this wrong space when I implement validation?
    You are attempting to use a semantic element, a paragraph, as a margin (you want "space" between an upper and lower <p>, yes?).

    <p>This is a sentence</p>
    <p>&nbsp;</p>
    <p>And this is another sentence. The invisible "<p>&nbsp;</p>" acts as a vertical spacer... and this is incorrect use of the tag.</p>


    Try this instead:
    In your CSS:

    p {margin:14px 0 6px 0}

    This creates 14-pixels margin on the TOP of every/any "<p>", zero-pixels right and left, and a 'safety margin' of 6-pixels margin-bottom. Adjust according to needs and appearance.

    p {margin:14px 0 6px 0} = p {margin:TOP - RIGHT - BOTTOM - LEFT}

    Why is "<p>&nbsp;</p>" incorrect? Screen readers correctly identify this as 'a paragraph' but there is no content. No text. -How is that 'bad' (in error)?
    -You're not blind, are you? As a seeing-person, -if you bought a newspaper or book/magazine and got it home only to discover that whole entire pages inside are 100% BLANK, -no text... -wouldn't you be upset or at least, a little ...confused?? THAT is what an "empty <p>" is to a text-to-speech/text-to-braille reader for the blind reads this as..


    Another way for 'special use' of a <p> that requires line-breaks ("<br />") is this:

    <p style="margin:3px 0 3px 0;">
    My address<br />
    My text1<br />
    NY25689 </p>

    By stripping out the default or otherwise-stated margin value (I used margin:14px 0 6px 0), you get nice, tight text instead of the 14-px top and the 6-px bottom...

    I'd opt for a class="this"

    HTML:
    Quote:
    <p class="this">
    My address<br />
    My text1<br />
    NY25689 </p>
    and CSS:
    Quote:
    .this {margin:3px 0 3px 0;}
    __________________
    Help Save Ana My Portal: I Build WebPages
    Pricing? Read:http://www.webdeveloper.com/forum/pricing_faq.html
    AUP: http://www.jupitermedia.com/corporate/privacy/aup.html
    I test with: Firefox, Mozilla, Opera, Safari-on-XP, Google Chrome, SeaMonkey
    Internet.com freelancers

    Last edited by WebJoel; 06-04-2007 at 01:08 PM.
    Reply With Quote
      #10  
    Old 06-04-2007, 05:00 PM
    ray326's Avatar
    ray326 ray326 is offline
    Got Link?
     
    Join Date: Nov 2003
    Location: Jerryville, Tejas
    Posts: 11,741
    You might consider using <address> instead of <p> for that to be a little more semantically correct. It also gives you more tag diversity for styling purposes.
    __________________
    Help Save Ana

    Why use Web Standards: Zeldman
    How (new): Castro
    How (experienced): Cederholm
    If you can only get one book and you're already HTML savvy then this is it:
    stylin' with CSS: A Designer's Guide
    Charles Wyke-Smith
    New Riders


    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan
    Reply With Quote
      #11  
    Old 06-05-2007, 03:30 AM
    bokeh's Avatar
    bokeh bokeh is offline
    Keep it simple, stupid!
     
    Join Date: Jan 2005
    Location: Alicante (Spain)
    Posts: 7,708
    Quote:
    Originally Posted by toplisek
    I have problem that p means paragraph. So, it is space between p tags and It should be My text1 within p. In other case it will be too much space.
    toplisek, that's what the stylesheet is for. Don't rely on the browser's default behaviour because they are all different.
    Reply With Quote
      #12  
    Old 06-05-2007, 04:56 AM
    HazardTW HazardTW is offline
    Registered User
     
    Join Date: Apr 2007
    Posts: 152
    lol@ray, it took 10 posts before someone mentioned the <address> tag to solve his address problem
    Reply With Quote
      #13  
    Old 06-05-2007, 09:10 AM
    WebJoel's Avatar
    WebJoel WebJoel is offline
    Super Moderator
     
    Join Date: Dec 2005
    Location: American, living in Toronto, ON. CANADA
    Posts: 6,668
    Quote:
    Originally Posted by HazardTW
    lol@ray, it took 10 posts before someone mentioned the <address> tag to solve his address problem
    hahahaa... -true!
    __________________
    Help Save Ana My Portal: I Build WebPages
    Pricing? Read:http://www.webdeveloper.com/forum/pricing_faq.html
    AUP: http://www.jupitermedia.com/corporate/privacy/aup.html
    I test with: Firefox, Mozilla, Opera, Safari-on-XP, Google Chrome, SeaMonkey
    Internet.com freelancers
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 03:45 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.