Reply LinkBack Thread Tools Search this Thread
Old 05-04-2008, 11:26   #1 (permalink)
30equals
Senior Member
 
Join Date: Jan 2006
Posts: 146
css - placing inline elements with margin

hi all

i was wondering if it's possible - without using floats and adding custom margins to certain elements - to place div's inline and automatically create a margin between them.
sort of like aligning them justified

for instance, i have a container, and two div's. the container's width is 10 px larger than the total width of the 2 div's combined. so room for 10px margin between them
i want one div to the left and one to the right, so you automatically create that margin between the two.

i don't really want to use floats because the content will be created dynamically, and i'm not sure how many div's will be in the container in the end. and i don't know to what extend it will be possible to put some custom code in it to alternately use a float:left and float:right if you know what i mean.

i've already looked around, and found a partial solution for FF
display: -moz-inline-box;
but oddly enough this creates a margin of 5px to the left and right of the 2nd div.

and display:inline-block doesn't work either

any ideas ?
  Reply With Quote
Old 05-04-2008, 18:08   #2 (permalink)
unchaste
Registered User
 
Join Date: Mar 2008
Posts: 59
I'm VERY new to this but wouldn't just a 10px right margin on the left div do it?
  Reply With Quote
Old 05-04-2008, 19:11   #3 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
Rethink your markup scheme. Floating them is not going to be a problem. I guarantee it.
  Reply With Quote
Old 06-04-2008, 07:03   #4 (permalink)
30equals
Senior Member
 
Join Date: Jan 2006
Posts: 146
Quote:
Originally Posted by pgo
Rethink your markup scheme. Floating them is not going to be a problem. I guarantee it.

could you please elaborate ?

the basic setup is a 3 column layout with divs.
each column div has it's own margins, if i want to float those elements i'm struggling with, i'd have to take away the margin of the columns div and put margins on each of the different container div's or floating elements in that column. is that what you mean ?
  Reply With Quote
Old 06-04-2008, 21:32   #5 (permalink)
bazzle
Senior Member
 
bazzle's Avatar
 
Join Date: Aug 2007
Location: Derby uk
Posts: 585
Send a message via MSN to bazzle
I don't understand how dynamic content would effect how you should layout your page.

As far as I know, the only way to get block level elements to sit next to eachother is by using float, or inline-block.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8