Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts

    What spacing methods do you use?

    What spacing methods do you use for basic text and image sections of your site? For example, in my main content, I usually use two <br>s to put some space between the article and an image/video. Sometimes I use a combination of <p> and <br> instead of setting up a CSS style since I vary the amount.

    Anything wrong with that method?

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello cineweekly.com,
    The semantic approach is for markup to contian the information and CSS to style it.
    Empty p tags and breaks are not information.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    New Coder
    Join Date
    Dec 2010
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i use </BR> tag for break the line.

  • #4
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    re

    Empty p tags are not valid, but you can add upto 2 <br> tags, to be valid, any more and you need to use CSS I read somewhere.

  • #5
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Can anyone find a source that says two <br> tags are valid? That could really be useful when IE adds too much blank space to <p>'s, I can just use two <br>s sometimes.

  • #6
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Quote Originally Posted by cineweekly.com View Post
    That could really be useful when IE adds too much blank space to <p>'s, I can just use two <br>s sometimes.
    Or, you could just use CSS to style the p tag.
    You can put however much or little space you want on any p tag you care to.

    I keep saying, there is no need to try controlling the layout with HTML.

    Two <br />'s may be valid code but that doesn't make it semantic.
    Last edited by Excavator; 12-12-2010 at 09:39 AM.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #7
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    re

    Something about <br>tags are not semantic text and should be used sparingly.

    I cannot find the teachings that suggested I only use 2 <br> tags, but the WC3 recommends using <br> for only a br line and not to create a paragraph.

  • #8
    New Coder
    Join Date
    Dec 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think it's better to use CSS than put a number of <br> tags in your code. You can use a lot of CSS methods = margings, padding, etc.

  • #9
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts
    But I never know what content will be above or below a <p> so I don't know how much space is needed until I create that content. I don't want to end up with a 20 css styles for various margin spacings.

    Other than that I do have a generic margin/padding set for <p> and various classes of <p>.

  • #10
    Regular Coder
    Join Date
    May 2009
    Posts
    813
    Thanks
    123
    Thanked 24 Times in 24 Posts

    re

    2 breaks are not too bad semantically.
    I always style my paragraphs with

    p {margin-bottom: 15px;}

    and you could then add a class for the top of some p tags if needed, other than that there is not really anything else to say about them, as p tags are what they are and so are break tags


  •  

    Posting Permissions

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