473,378 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Making floated element alignments to center

Is it possible to change #wrapper's inner elements alignments to center of page? I think its possible by using TABLE, but what about DIV?
Expand|Select|Wrap|Line Numbers
  1. <style>
  2. #left {
  3.     background: red;
  4.     width: 100px;
  5.     float: left;
  6. }
  7.  
  8. #center {
  9.     background: green;
  10.     width: 200px;
  11.     float: left;
  12. }
  13.  
  14. #right {
  15.     background: blue;
  16.     width: 100px;
  17.     float: left;
  18. }
  19. </style>
  20. <div id="wrapper">
  21.     <div id="left">LEFT</div>
  22.     <div id="center">CENTER</div>
  23.     <div id="right">RIGHT</div>
  24. </div>
  25.  
Dec 3 '09 #1
1 1338
drhowarddrfine
7,435 Expert 4TB
If you assign a width to the wrapper div and give it margin:0 auto that will center it.
Dec 3 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Lorentz | last post by:
Greetings. I have a process that takes data from a MS Access2000 database and produces .pdf files. Everything works fine... but I'm trying to format the header and footer of the pdf file so...
2
by: Ney André de Mello Zunino | last post by:
Hello. The issue is quite known: you have a block-level container holding a set of floated elements and you need that the container's content height take the floated elements' dimensions into...
4
by: boclair | last post by:
Is this a known problem with IE6? I have a provisional two column layout, the left menu column is positioned absolute. The contents column is positioned relative. The contents column has an...
26
by: puzzled | last post by:
Okay, so my subject sounds a bit crass. As much as I'd like to totally embrace css and avoid "deprecated" usage, sometimes the deprecated stuff is so much easier and more effective. Plus, it at...
12
by: The Master | last post by:
>>does a floated element require a fixed width to work? >It does if the UA adheres to CSS 2.0 rules, not if it adheres to CSS 2.1 >float rules (or if it's IE). So does that mean nn6, moz1.0,...
3
by: Lee K. Seitz | last post by:
I'm redesigning this page for more up-to-date browser standards: <http://home.hiwaay.net/~lkseitz/hhs/winners.shtml>. Note the use of an "invisible" table to position the "visible" ones. I'm...
24
by: Thomas Mlynarczyk | last post by:
Hi, Here's what I have: <div> <img ...><br> Caption text </div> The div is floated left and has no width set, the content is centered, there are no margins or padding on the <img> (just a...
26
by: meltedown | last post by:
I have 2 left floating divs on a page. Sometime the left side is larger, sometimes the right side is larger. I want the page to have a margin at the bottom of whichever div is the largest. If I...
2
by: andrew18 | last post by:
Hi All, Two questions: 1. Is it possible to make a floated div grow in width with its contents? I've been searching on the web for a way to make the width of a float grow with the width of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.