Results 1 to 3 of 3

Thread: Is this OK, or am I a XHTML-Terrorist

  1. #1
    Join Date
    Jul 2005

    Is this OK, or am I a XHTML-Terrorist

    Working on converting a large content managment driven site to Valid XHTML and is trying to keep all Editorial functions as they are.

    I'm parsing text from a textarea. I start by defining a paragraph and parse two or more newlines to end it and create a new paragraph. The Editors are allowed to put a picture with caption, a quote block, a fact box etc. wherever they want in the body text (and have been doing so in tens of thousands of articles that I have to keep).

    Nesting a <div> inside a <p> ... </p> is not valid and I cant't force the image, qoute, factbox... to be placed outside the paragraph. The only easy solution I want to use is to put the elemts inside a inline-element such as a span, making it valid, but redefine the span to display: block;

    <style type="text/css">
    .float {
    display: block;
    float: right;

    Lorem ipsum dolor sit amet, consectetuer adipiscing
    elit. Etiam vitae sapien. Quisque dictum. Nunc orci
    <span class="float"><img src="lorem.jpg" width="100" height="150" border="0" alt="alttext" />
    <br />Caption
    lacus, rutrum eu, elementum quis, rhoncus iaculis, risus.
    Pellentesque habitant morbi tristique senectus et netus
    et malesuada fames ac turpis egestas.

    Is fooling the validator like this OK? Or am I terrorising the quest for a valid marked-up internet! I think it's for a good cause. The Image in this example is inline, inside a pargraph where it actually belongs if that's where the Editor put it. The blockifying done with CSS is just for layout purposes!

  2. #2
    Join Date
    Nov 2002
    XYZZY - UK
    Whether its sensible is debatable but perfectly legal.

  3. #3
    Join Date
    Jul 2005
    Floated elements are automatically given display:block.
    No need for the <br />, just use the following code.

    .float {
      float: right;
    .float img {
      display: block;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Recent Articles