Current location: Hot Scripts Forums » General Web Coding » CSS » position of several divs


position of several divs

Reply
  #1 (permalink)  
Old 04-20-09, 08:28 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
position of several divs

Hi there..

I got this css to set the parameters of my divs:
Code:
#footer  { width: 792px; height: 36px;  margin: 0; padding: 0; }
#bottom  { height: 10px; margin: 0; padding: 0px 0px 0px 0px; float:left; margin-left: auto; margin-right: auto; }

#bottomlink  { margin: 0; padding: 3px 8px 0px 8px; float: left; border: 0px solid #ff00ff; display: inline; }
#divider  { width: 1px; height: 13px; margin: 0; padding: 0px 0px 0px 0px; float: left; background-color: #636161;}
This is the html that belongs to this:

HTML Code:
<div id="footer">
	<div id="bottom">
		<div id="divider"></div>
		<div id="bottomlink"><a href="#" class="footer">contact</a></div>
		<div id="divider"></div>
		<div id="bottomlink"><a href="#" class="footer">algemene verkoopvoorwaarden</a></div>
		<div id="divider"></div>
		<div id="bottomlink"><a href="#" class="footer">disclaimer</a></div>
		<div id="divider"></div>
	</div>
</div>
What should happen is that "bottom" is centered inside "footer"
I thought delete the float parameter in the "bottom" parameters should do
the job, but then the width of "bottom" is set to 792px.
And that is not making it center.

It's not possible to set the width of "bottom" (which would do the job)
because the text showed there is variable.

who can help me out here...

_j
Reply With Quote
  #2 (permalink)  
Old 04-20-09, 10:03 PM
forgueam's Avatar
forgueam forgueam is offline
iNET Code Serf
 
Join Date: Aug 2007
Location: West Chester, OH, USA
Posts: 39
Thanks: 0
Thanked 1 Time in 1 Post
Jonnekke,

This is probably the way I would do it:

CSS:

Code:
#footer  { width: 792px; height: 36px;  margin: 0; padding: 0; text-align: center; }

#footer ul { list-style: none; margin: 0; padding: 0; }
#footer ul li { border-left: 1px solid #636161; display: inline; height: 13px; margin: 0; padding: 3px 8px 0px; }
#footer ul li.last { border-right: 1px solid #636161; }
HTML:

Code:
<div id="footer">
	<ul>
		<li><a href="#" class="footer">contact</a></li>
		<li><a href="#" class="footer">algemene verkoopvoorwaarden</a></li>
		<li class="last"><a href="#" class="footer">disclaimer</a></li>
	</ul>
</div>
By placing the links in an unordered list, your code becomes much more semantic, easier to read, and less sizeable. Hope this helps!
Reply With Quote
  #3 (permalink)  
Old 04-23-09, 01:32 AM
harish harish is offline
Newbie Coder
 
Join Date: Apr 2009
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
#bottom { clear:both; height: 10px; margin: 0; padding: 0px 0px 0px 0px; float:left; margin-left: auto; margin-right: auto; }

Clear both
It’s also important to set your clear property in the #bottom declaration to both, so that
regardless of the length of either column, the footer will always appear below the
columns.
The results should appear identical to Figure 12-4, yet the order of the markup has been
improved.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Any visual css editor that writes the dimensions of the divs in a .css file? tirengarfio CSS 0 12-28-08 05:44 PM
I like CSS but it acts Stupid!!! mcrob CSS 4 11-20-08 02:06 PM
Firefox and align problems gigafare CSS 12 01-07-07 11:22 AM
Seeking a Competitive Full-Time Position ( PHP Programmer ) shadi Job Offers & Assistance 0 12-03-05 08:40 AM
Tab Position sh1 HTML/XHTML/XML 0 10-20-05 09:43 AM


All times are GMT -5. The time now is 02:19 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.