PDA

View Full Version : css not setting margins



Moh
14-02-2008, 06:46 PM
Well I am currently coding a layout, but the margins for the text dosn't seam to be working.
in my css I have got:


#box_right {
background-image: url(images/boxs/box_right.gif);
background-position: right bottom;
text-align: left;
font-size:11px;
margin-bottom:9px;
margin-right:9px;
}

And for the content box I have got:

<table cellpadding="0" cellspacing="0" width="276">
<tr>
<td id="black_box_left"></td>
<td id="black_box_right" width="266">box title</td>
</tr>
<tr>
<td id="box_left"></td>
<td id="box_right">Lorem ipsum dolor sit amet, consectetuer adipiscing
elit. Donec ac neque non massa interdum rutrum. Nulla feugiat. Fusce
ultrices, eros at lobortis elementum, enim neque blandit lectus, at
vestibulum neque turpis eget arcu. Vivamus hendrerit varius tellus.
Suspendisse nec eros a nisi dapibus condimentum. Praesent vestibulum.
Vestibulum interdum, quam sed facilisis sollicitudin, ligula velit
tristique turpis, vitae blandit augue lacus ac augue. Vestibulum urna
justo, ornare vitae, rhoncus non, lacinia sed, justo. Phasellus varius.
Aenean sem. Nunc purus. Sed facilisis urna aliquet lorem. Proin eleifend,
nunc sit amet hendrerit hendrerit, est dolor aliquam purus, in pharetra
est velit sit amet lectus. Nam tincidunt, lectus ut blandit consectetuer,
sem justo iaculis nulla, sed bibendum lacus mi non ipsum.</td>
</tr>
</table>

Is there anything wrong there? Or have I most probably set a default setting for td?

theJOSH
14-02-2008, 07:01 PM
CSS is meant to use Divs?
Not tables?

Awfy
14-02-2008, 07:01 PM
Sure you can do margins on <td>? I always thought it was cell-spacing.

theJOSH
14-02-2008, 07:02 PM
Sure you can do margins on <td>? I always thought it was cell-spacing.

You can put a div inside a table,
But you can't set up the CSS, with a table, as far as I know.

Moh
14-02-2008, 07:06 PM
Sure you can do margins on <td>? I always thought it was cell-spacing.
Yes, but I would rather do it all on the css as you can easily change it.


You can put a div inside a table,
But you can't set up the CSS, with a table, as far as I know.
If you couldn't add css to tables, then the rest of the style such as backgrounds wouldn't work.
Its just like <td style="background-image:url(file.gif);">

theJOSH
14-02-2008, 07:07 PM
Yes, but I would rather do it all on the css as you can easily change it.


If you couldn't add css to tables, then the rest of the style such as backgrounds wouldn't work.
Its just like <table style="background-image:url(file.gif);">

The CSS, Classes must be aligned to divs in the main html,
So you'd put a div inside a table.

Moh
14-02-2008, 07:13 PM
The CSS, Classes must be aligned to divs in the main html,
So you'd put a div inside a table.
im not using classes im using ids.

Like I said, the rest of the style is working.
This is what it looks like.
http://img174.imageshack.us/img174/3097/showboxqf0.gif

RedCrisps
14-02-2008, 07:21 PM
padding-bottom: 9px;

Blob
14-02-2008, 07:22 PM
#box_right {
background-image: url(images/boxs/box_right.gif);
background-position: right bottom;
text-align: left;
font-size:11px;
padding-bottom:9px;
padding-right:9px;
}

margin makes the whole thing move. padding makes the box insides move.

Moh
14-02-2008, 07:23 PM
padding-bottom: 9px;


#box_right {
background-image: url(images/boxs/box_right.gif);
background-position: right bottom;
text-align: left;
font-size:11px;
padding-bottom:9px;
padding-right:9px;
}

margin makes the whole thing move. padding makes the box insides move.
You two are stars!
+Rep :)

Blob, remind me. I need to spread.

Awfy
14-02-2008, 07:50 PM
God that's all you wanted? I thought you wanted the two cells appart, could of said you just wanted the content inside the cells indented... :l

RedCrisps
14-02-2008, 07:51 PM
t'was easy when i saw the image.

Moh
14-02-2008, 08:04 PM
God that's all you wanted? I thought you wanted the two cells appart, could of said you just wanted the content inside the cells indented... :l
Oh fine, you can have Rep too.


t'was easy when i saw the image.
I always thought they were done by margins :S
Learn something new every week xD

Want to hide these adverts? Register an account for free!