Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Problem with the <div> elements?

I have one line of <div>'s. Then I have another line of <div>'s. The problem is when I write in the first line <div>'s, the second line <div>'s will go down with the text and won't stay vertical. How do I get the second row to stay vertical align? I tried the vertical-align but it didn't work, any ideas?

5 Answers

Relevance
  • 4 years ago

    div's are blocks, and by utilizing default each div aspect makes use of an entire line. in case you elect for 2 (or more advantageous) div's in an similar line, all diverse than one in each of them should be set as pick for the flow. e.g. <div style="pick for the flow: left">#11c489dbe8d9c62d676706d7685cce6c0... style="pick for the flow:left">#21c489dbe8d9c62d676706d7685c...

  • 1 decade ago

    div's are blocks, and by default each div element uses a whole line.

    If you want two (or more) div's in the same line, all except one of them should be set as FLOAT.

    e.g.

    <div style="float: left">#1</div><div style="float:left">#2</div><div>#3</div>

  • If you want them to appear inline you should either use <span> tags or use the style attribute <div style="display:inline">

  • How do you think about the answers? You can sign in to vote the answer.
  • 1 decade ago

    Have you tried laying out the Divs inside a table?

    <table>

    <tr>

    <td>

    <div></div>

    </td>

    <td>

    <div></div>

    </td>

    </tr>

    <tr>

    <td>

    <div></div>

    </td>

    <td>

    <div></div>

    </td>

    </tr>

    </table>

    You can also try setting the DIV's style to "display:inline;". I really need more info to answer any better.

    Can you show me an example of what you are trying to achieve, that would make debugging simpler. :)

Still have questions? Get your answers by asking now.