SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    Australia
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Unwelcomed Breaks

    I'm using a work CMS that has an unfortunate habit of automatically inserting a break after all div and UL tags like this:

    </div><br>

    </ul><br>

    This creates unsightly gaps below the text blocks. If I have nested bullets inside a bullet list it creates a </ul><br> at the end of the indented/nested bullets, again unsightly as there is a big gap in the middle of the list.

    I can't block this behaviour as the CMS scans and inserts the code and I don't have high enough admin access to alter it. Is there any way through the stylesheet to say "if br follows div or /ul then 0px" or somesuch?

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,597
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Sounds like a yucky CMS! One easy way around it is to add this to your stylesheet:

    Code:
    br {display: none;}
    If that's too absolute, you could target those more specific instances like so:

    Code:
    div + br, ul + br {display: none;}
    That's a specific way to say "if br follows div or /ul then …"

  3. #3
    Mouse catcher silver trophy
    Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,828
    Mentioned
    110 Post(s)
    Tagged
    1 Thread(s)
    And people wonder why I don't like CMSs. Do you not have access to a code view at all? If not, I find a good technique is to pester the people who do have that level of access with so many incessant requests for changes to the codebase that eventually they give up and give you the access you need!

  4. #4
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,732
    Mentioned
    31 Post(s)
    Tagged
    0 Thread(s)
    it's prolly not the CMS, exactly. Some versions of TinyMCE save blank characters as line returns or vice versa... a text filter may read those as "\n" and conver them to <br>.. it's kinda a pain, but it may simply mean that you need to adjust the character filter on your CMS, if you can, or try NOT spacing your paragraphs, list etc when you enter them...

    yeah, it's still a pain I know.

  5. #5
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    Australia
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The CMS templates and code were produced years ago and so many pages built on them that they won't touch them for fear of breaking something. They were created before wide use of CSS. Think Win NT SOE in a workplace and you get the idea.

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,597
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Have you tried the CSS solution I posted? It will do the trick.

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    Australia
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've just been testing. Display none makes the tags disappear, but this worked well to counteract the extra spacing:

    br + ul, br + ol, ul + br, ol + br {margin-top: -5px;}

    However you can't specify any width or side margins as IE 7 is buggy with width in ordered lists.

    Thanks for your assistance.

  8. #8
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,597
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Personally, I think display: none is cleaner and more reliable, but it's up to you. I guess another solution might be position: absolute; left: -9999px, but I don't see the point. Display: none just hides them from everything.


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
  •