Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Div tags, how to create rows with them

Tags:

html

How to you define a row in div tags

High level example in pseudo code:

[DIV TAGS LEFT]  [DIV TAGS CENTER] [DIV TAGS RIGHT]

[WHAT GOES HERE?????]

[DIV TAGS LEFT]  [DIV TAGS CENTER] [DIV TAGS RIGHT]

[WHAT GOES HERE?????]

[DIV TAGS LEFT]  [DIV TAGS CENTER] [DIV TAGS RIGHT]
like image 467
Daniel Kivatinos Avatar asked Jun 17 '10 07:06

Daniel Kivatinos


People also ask

How do I create a row in a div?

To create rows, add a div with a class=“row” that encases the column code. Rows must always be placed inside of a container. Rows span the width of the container. They have a negative 15 pixel margin at the end, essentially removing the 15 pixel margin set by its container.

How do I put multiple lines in one div?

By default, if we have multiple div tags it will be displayed one below the other. In othere words, each div will be displayed in a separate line. To display multiple div tags in the same line, we can use the float property in CSS styles. The float property takes left, right,none(default value) and inherit as values.


3 Answers

this may work

<style>
.parent {
    margin-bottom: 15px;
    padding: 10px;
    color: #0A416B;
    clear:both;
}
.left, .center, .right{
    float:left;
    width:32%;
    border:1px solid #CEDCEA; 
    padding:5px;

}
</style>


<div class="parent">
    <div class="left">
        Left
    </div>
    <div class="center">
        center
    </div>
    <div class="right">
        right
    </div>
    <div style="clear:both;"></div>
</div>
like image 109
kamal Avatar answered Oct 31 '22 09:10

kamal


If I understand the question, you need this HTML structure:

<div class="row">
   <div class="left"></div><div class="center"></div><div class="right"></div>
</div>

... and this CSS:

div.row {
  clear:both;
}
like image 30
drummondj Avatar answered Oct 31 '22 08:10

drummondj


<div class="parent">
  <div class="left">left</div>
  <div class="center">center</div>
  <div class="right">right</div>
</div>

styling:

.parent {
  overflow: auto;
}

.parent>div {
  float: left;
  width: 33%;
}

This should give you what your looking for.

like image 2
Ben Rowe Avatar answered Oct 31 '22 07:10

Ben Rowe