Forum Moderators: not2easy

Message Too Old, No Replies

CSS margin for text...

         

irock

4:39 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<div align=left class="text">blah blah blah</div>

I would like to know if there's a way to add CSS left, right, top, bottom margin inside <div> w/o modifying my "text" class.

Thanks!

benihana

4:43 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you can add more than one class to the div:

<div align=left class="text margin">blah blah blah</div>

then define your margins in a class called margin.

irock

4:52 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One more question...

How do I define 2 pixel, 2 pixel, 2 pixel, 2 pixel for top, bottom, left & right margin? I forgot the exact syntax.

Thanks again!

benihana

4:59 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



i think you can just put

.margin{
margin:2px;
}

irock

5:02 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do I put that inside <div> tags w/o adding another class? Is that possible?

benihana

5:08 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



well you could put <div style="margin:2px;" class="text">

but if you are going to use it more than once, then make another class.

alternatively, if all divs are to have the same margin, put this in your css:

div {
margin:2px;
}

Dan_B

5:10 pm on Feb 18, 2004 (gmt 0)



Or you could make a new class in your stylesheet

.someclass { margin: 2px; }

and have both classes applied to the div

<div align=left class="text, someclass">blah blah blah</div>

benihana

5:12 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



welcome to webmaster world dan_b.

please read the rest of the thread..... :)

photon

6:56 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do I define 2 pixel, 2 pixel, 2 pixel, 2 pixel for top, bottom, left & right margin? I forgot the exact syntax.

If they are all the same, you can use the shortcut methof benihana mentioned. If they're different the order is Top, Right, Bottom, Left. You can remember the order because you'll be in TRouBLe if you don't. :)