block element inside inline element

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ste.paoletti@tiscali.it

    block element inside inline element

    Hi.
    The code of my page is generated by script. However the code is the
    following (I write it manually, sorry if there are some errors):
    <span class="question ">
    <span class="number"> 1</span>
    <span class="content" > Here can stay span with text childNode, image,
    animation,etc.. </span>
    </span>

    The question span is display block.
    I want the number and the firstchild of the content in the same line.
    The best thing to do is set the display:block property of the content
    span and also the position:relati ve and use top and left property to
    align the block of content with the number.(all the content is
    display:block)
    But in this way I have some problems whit the application so it don't
    work (the cause is position:relati ve).
    So, I have try whit number and content display:inline, the firstChild
    of the content also display:inline, and the rest of the content
    display:block.
    In this way I have block elements (the second, third,... child of the
    content span) inside a inline element (the content span).
    It should work only on mozilla(1.6 or later) and firefox.
    The xhtml is valid or not?
    It is correct?
    Thanks

  • Johannes Koch

    #2
    Re: block element inside inline element

    ste.paoletti@ti scali.it wrote:[color=blue]
    > The code of my page is generated by script. However the code is the
    > following (I write it manually, sorry if there are some errors):
    > <span class="question ">
    > <span class="number"> 1</span>
    > <span class="content" > Here can stay span with text childNode, image,
    > animation,etc.. </span>
    > </span>
    >
    > The question span is display block.
    > I want the number and the firstchild of the content in the same line.[/color]

    That seems to be a list, right? So why don't you use an ordered list (ol
    with li) in HTML?

    --
    Johannes Koch
    Spem in alium nunquam habui praeter in te, Deus Israel.
    (Thomas Tallis, 40-part motet)

    Comment

    • Jim Moe

      #3
      Re: block element inside inline element

      ste.paoletti@ti scali.it wrote:[color=blue]
      > Hi.
      > The code of my page is generated by script. However the code is the
      > following (I write it manually, sorry if there are some errors):
      > <span class="question ">
      > <span class="number"> 1</span>
      > <span class="content" > Here can stay span with text childNode, image,
      > animation,etc.. </span>
      > </span>
      >
      > The question span is display block.
      >[/color]
      It does not matter. The above is valid HTML. That you have changed the
      *presentation* to a block is irrelevant.

      --
      jmm (hyphen) list (at) sohnen-moe (dot) com
      (Remove .AXSPAMGN for email)

      Comment

      • kchayka

        #4
        Re: block element inside inline element

        Jim Moe wrote:[color=blue]
        > ste.paoletti@ti scali.it wrote:[color=green]
        >>
        >> <span class="question ">
        >> <span class="number"> 1</span>
        >> <span class="content" > Here can stay span with text childNode, image,
        >> animation,etc.. </span>
        >> </span>
        >>[/color]
        > The above is valid HTML.[/color]
        ^^^^^

        I think that's debatable. Span soup isn't valid in my book. ;)

        "question" looks like it should be a block element, anyway, so span is
        definitely the wrong element for the job.

        --
        Reply email address is a bottomless spam bucket.
        Please reply to the group so everyone can share.

        Comment

        • Andy Dingley

          #5
          Re: block element inside inline element

          On Sat, 21 Jan 2006 19:43:02 -0600, kchayka <usenet@c-net.us> wrote:
          [color=blue][color=green]
          >> The above is valid HTML.[/color]
          >
          >I think that's debatable. Span soup isn't valid in my book. ;)[/color]

          It's not at all debatable. "Valid" has a formal meaning and this
          fragment (on a suitable page) meets it. It might not be "good practice",
          you might not like it, but it's still valid.

          <blockquote><bl ockquote>
          Foo
          </blockquote></blockquote>

          is also perfectly valid, even when it's only being used to mean "double
          indent". Not goo, maybe - but still formally valid.

          [color=blue]
          >"question" looks like it should be a block element, anyway,[/color]

          I'd probably agree.

          Personally I have no problem with "span soup". It's a few characters
          more, but it's not harmful. It also has many valid uses, particularly in
          a Semantic Web sense.

          Comment

          • Jasen Betts

            #6
            Re: block element inside inline element

            On 2006-01-21, ste.paoletti@ti scali.it <ste.paoletti@t iscali.it> wrote:[color=blue]
            > Hi.
            > The code of my page is generated by script. However the code is the
            > following (I write it manually, sorry if there are some errors):
            ><span class="question ">
            > <span class="number"> 1</span>
            > <span class="content" > Here can stay span with text childNode, image,
            > animation,etc.. </span>
            ></span>[/color]

            why not use <ol> instead?
            [color=blue]
            > The question span is display block.[/color]

            why not use a block element like <p> <div> or (gasp!) <li> ?

            If you match the HTML to the semantics of the content, the styles often
            become easier.

            --

            Bye.
            Jasen

            Comment

            Working...