div inside a p

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff Thies

    div inside a p

    I have this in IE5 windows:

    <p style="color: red">
    <div>This is not red</div>
    and this is red
    </p>

    Why is that? Are divs never allowed inside paragraphs?

    Jeff
  • David Dorward

    #2
    Re: div inside a p

    Jeff Thies wrote:
    [color=blue]
    > Why is that? Are divs never allowed inside paragraphs?[/color]

    http://validator.w3.org/ is your friend.

    But - yes. Paragraphs can only hold inline content.

    --
    David Dorward http://dorward.me.uk/

    Comment

    • Matthias Gutfeldt

      #3
      Re: div inside a p

      Jeff Thies wrote:[color=blue]
      > I have this in IE5 windows:
      >
      > <p style="color: red">
      > <div>This is not red</div>
      > and this is red
      > </p>
      >
      > Why is that? Are divs never allowed inside paragraphs?[/color]

      Never - well, never if you're using W3C HTML. There might be other HTML
      versions that allow it :-).


      Matthias

      Comment

      • Thomas Scholz

        #4
        Re: div inside a p

        David Dorward gestand:
        [color=blue]
        > Jeff Thies wrote:
        >[color=green]
        >> Why is that? Are divs never allowed inside paragraphs?[/color]
        >
        > But - yes. Paragraphs can only hold inline content.[/color]

        <p><object><div >Hello World!</div></object></p>

        :-)

        Thomas

        Comment

        • Thomas Scholz

          #5
          Re: div inside a p

          David Dorward gestand:
          [color=blue]
          > Jeff Thies wrote:
          >[color=green]
          >> Why is that? Are divs never allowed inside paragraphs?[/color]
          >
          > But - yes. Paragraphs can only hold inline content.[/color]

          <p><object><div >Hello World!</div></object></p>

          :-)

          Thomas

          Comment

          • David Dorward

            #6
            Re: div inside a p

            Jeff Thies wrote:
            [color=blue]
            > Thanks, I stumbled across this at the W3C just now:
            >
            > <FORM action="http://somesite.com/prog/adduser" method="post">
            > <P>
            > First name: <INPUT type="text" name="firstname "><BR>[/color]
            ....[color=blue]
            > </P>
            > </FORM>
            >
            > Which oddly enough is almost exactly what I was trying to do. But
            > without the zig zag alignment. Looks like I'll have to do this with divs
            > instead.[/color]

            Probably better with <label>, <fieldset>, <legend> and some CSS. Have a look
            at the contact form on my site (see sig) for an example.

            --
            David Dorward http://dorward.me.uk/

            Comment

            • David Dorward

              #7
              Re: div inside a p

              Jeff Thies wrote:
              [color=blue]
              > Thanks, I stumbled across this at the W3C just now:
              >
              > <FORM action="http://somesite.com/prog/adduser" method="post">
              > <P>
              > First name: <INPUT type="text" name="firstname "><BR>[/color]
              ....[color=blue]
              > </P>
              > </FORM>
              >
              > Which oddly enough is almost exactly what I was trying to do. But
              > without the zig zag alignment. Looks like I'll have to do this with divs
              > instead.[/color]

              Probably better with <label>, <fieldset>, <legend> and some CSS. Have a look
              at the contact form on my site (see sig) for an example.

              --
              David Dorward http://dorward.me.uk/

              Comment

              Working...