iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-14-2007, 01:09 PM
WebProWorld Pro
 
Join Date: Aug 2007
Location: Stuttgart Germany
Posts: 174
kruser RepRank 1
Default CSS - div position

Hello,

Looking to display two div's side by side.

This works in IE but not Netscape. In Netscape the div's are on top of each other.

<div style="float:left;">
this is column 1
</div>

<div>
this is column2
</div>

Any thoughts appreciated,
Randy
Reply With Quote
  #2 (permalink)  
Old 09-14-2007, 01:13 PM
rah's Avatar
rah rah is offline
Administrator
 
Join Date: Jul 2003
Location: Lexington, KY
Posts: 671
rah RepRank 4rah RepRank 4rah RepRank 4
Default Re: CSS - div position

Try doing a float left on both div tags. That should make them both sit next to each other.

The only problem that comes out of this is that you'll need a third div below those two with a clear: both on it to make sure that if one of the top two divs is longer than the other it doesn't push out of any container you may have.

Hope this helps,
Rafael
Reply With Quote
  #3 (permalink)  
Old 09-14-2007, 01:19 PM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,657
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: CSS - div position

You may also need to specify display:inline;
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #4 (permalink)  
Old 09-14-2007, 01:32 PM
WebProWorld Pro
 
Join Date: Aug 2007
Location: Stuttgart Germany
Posts: 174
kruser RepRank 1
Default Re: CSS - div position

Quote:
You may also need to specify display:inline;
wige - would the display:inline go in both div's ?
Reply With Quote
  #5 (permalink)  
Old 09-14-2007, 01:44 PM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,657
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: CSS - div position

Yes. By default divs are block elements, which are displayed on their own line, inline should override this.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #6 (permalink)  
Old 09-14-2007, 04:08 PM
WebProWorld Pro
 
Join Date: Aug 2007
Location: Stuttgart Germany
Posts: 174
kruser RepRank 1
Default Re: CSS - div position

Then this should cover replies so far.

<div style="float:left;display:inline;">
this is column 1
</div>

<div style="float:left;display:inline;">
this is column 2
</div>

<div style="clear:both;">
&nbsp;
</div>
Reply With Quote
  #7 (permalink)  
Old 09-15-2007, 12:14 AM
WebProWorld Member
 
Join Date: Aug 2007
Location: Hanoi - Seattle
Posts: 58
hpham RepRank 1
Default Re: CSS - div position

try to set their width. usually, if it's 2 column page, I set the first float is left, and the second is right. It works fine for me on both IE and Firefox, tested on Safari too
Reply With Quote
  #8 (permalink)  
Old 09-16-2007, 12:53 AM
WebProWorld Pro
 
Join Date: Aug 2007
Location: Stuttgart Germany
Posts: 174
kruser RepRank 1
Default Re: CSS - div position

That would mean...

<div style="float:left;display:inline;width:45%;">
this is column 1
</div>

<div style="float:right;display:inline;width:45%">
this is column 2
</div>

<div style="clear:both;">
&nbsp;
</div>

...would be good CSS style for two columns side by side
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
From position 8 to position 76 in five days... Please help webitaly Google Discussion Forum 44 01-06-2007 03:12 AM
From Position 29 to 685? nipplecharms1 Google Discussion Forum 69 07-31-2006 03:49 PM
web position acazalet Search Engine Optimization Forum 1 07-27-2005 09:29 PM
had #2 position for one day, then gone! tcady Search Engine Optimization Forum 3 08-12-2004 07:56 AM
how come such a low position? astoller Google Discussion Forum 2 07-28-2004 07:59 PM


All times are GMT -4. The time now is 05:45 AM.



Search Engine Optimization by vBSEO 3.3.0