Hi everyone, first post around here.
I'm trying to learn about proper use of CSS, and in doing so, I found a problem with a formatting of a table cell I need to design for work:
The table cell contains a number of div tags which should be centered (in the cell), and should appear like this
Left Center top Right top
Center bottom Right bottom
The main idea I had was to enclose the center and right divs into another div, and use float: left on every "main" div to make them appear side-by-side, and as closer to each other as possible (so that some of the content of one DIV overlaps with the other DIV next to it). The code I'm using is this (please ignore the fact that the CSS is inline and to a certain extent, the width values, I'm just using those to test):
The problems I'm having are that:
1. I can't get the DIVs to overlap
2. The DIVs are not centered (i.e.: the global DIV is not centering them inside it)
3. I'm not exactly sure about having "float: left;" in every "main" DIV (is it correct, I mean?)
4. All of them are aligned to the left (direct consequence of having "float: left"?)
Thanks in advance for any help. I'm sure I can understand CSS better like this.
I'm trying to learn about proper use of CSS, and in doing so, I found a problem with a formatting of a table cell I need to design for work:
The table cell contains a number of div tags which should be centered (in the cell), and should appear like this
Left Center top Right top
Center bottom Right bottom
The main idea I had was to enclose the center and right divs into another div, and use float: left on every "main" div to make them appear side-by-side, and as closer to each other as possible (so that some of the content of one DIV overlaps with the other DIV next to it). The code I'm using is this (please ignore the fact that the CSS is inline and to a certain extent, the width values, I'm just using those to test):
Code:
<div style="padding: 0; margin: 0 auto; width: 299px; text-align: center; border: #000000 1px solid;">
global
<div style="float: left; border: #ff0000 1px solid; width: 15px;">
left
</div>
<div style="float: left; border: #00ff00 1px solid; width: 50px;">
<div>
center top
</div>
<div>
center bottom
</div>
</div>
<div style="float: left; border: #0000ff 1px solid; width: 30px;">
<div>
right top
</div>
<div>
right bottom
</div>
</div>
</div>
The problems I'm having are that:
1. I can't get the DIVs to overlap
2. The DIVs are not centered (i.e.: the global DIV is not centering them inside it)
3. I'm not exactly sure about having "float: left;" in every "main" DIV (is it correct, I mean?)
4. All of them are aligned to the left (direct consequence of having "float: left"?)
Thanks in advance for any help. I'm sure I can understand CSS better like this.