SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Strange <fieldset> Problem with word spacing.

    This problem is evident in Firefox and not Internet Explorer (there's a first for everything )

    Two sets of code:

    1.
    HTML Code:
    <strong>strong text</strong> <em>emphasised text</em> normal text
    Note the spaces between the separate parts.

    2.
    HTML Code:
    <fieldset><strong>strong text</strong> <em>emphasised text</em> normal text</fieldset>

    The Problem
    In FireFox, when the text is in a fieldset, the spaces between the different parts don't show. I don't know whether this is a feature of CSS or not, but I hope it isn't .

    Does anyone know why this happens? fixes?

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,366
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    I don't know why it happens but quite often the browsers will interptet the white space in the html differently.

    The fix is easy just move the space inside the tags like so:
    Code:
    <fieldset><strong>strong text </strong><em> emphasised text </em>normal text</fieldset>
    Should be the same now with any luck

    paul

  3. #3
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That works but it's a bit of an irritance to have to do that. I've noticed the space doesn't appear when it's just after a closing tag - this is quite an annoying problem. I was hoping it was a known problem with a known fix or something.

    The main issue at hand is it's not practical for me to put the space between the tags, and this problem will be quite significant when using dynamic content, or maybe having users post news with html in it.

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,366
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    Well the solution is not to rely on the browser interpreting white space between opening and closing tags when there is no other content and to put the spacing in yoursself.
    Code:
    <!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">
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
    fieldset strong {padding-right:3px}
    fieldset em {padding-right:3px}
    </style>
    </head>
    <body>
    <fieldset><strong>strong text</strong><em>emphasised text</em>normal text</fieldset>
    </body>
    </html>
    Now it doesn't matter if its dynamic content or not

    Paul

  5. #5
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well that's an interesting way of looking at it - I might give that a try, and see if it works out or if there are still areas where the padding might be inappropriate, such as will not stretch the fieldset if it's right near the edge?

    Also, what about varying font sizes - spacing will also vary...

  6. #6
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,366
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    what about varying font sizes - spacing will also vary
    ermmmm ems

    paul


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
  •