473,385 Members | 1,384 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,385 software developers and data experts.

horizontally align div

347 100+
I have a page that has rows and columns of divs within a main div and am trying to align them to centre if the divs do not fill the line

example here

http://www.yaketyyak.co.uk/newpages/boys.asp?id=Dutch

the main div css is as follows
Expand|Select|Wrap|Line Numbers
  1. #artists {
  2.     float: left;
  3.     height: 615px;
  4.     width: 840px;
  5.     overflow:auto;
  6.     overflow-x:hidden;
  7.     overflow-y: auto;
  8.     top: 180px;
  9.     /* [disabled]background-color: #FFF; */
  10.     padding: 5px;
  11. }
and the internal div for each element is this

Expand|Select|Wrap|Line Numbers
  1. .artistboys  {
  2.     /*border: 1px solid #f39617;*/
  3.     width: 85px;
  4.     height: 130px;
  5.     margin-top: 7px;
  6.     margin-right: 7px;
  7.     margin-bottom: 7px;
  8.     margin-left: 7px;
  9.     padding-top: 10px;
  10.     text-align: center;
  11. }
i have tried everything i know but all i can get is a long list of single elemnts under one another??

any help would be appreciated
Jul 17 '12 #1
3 2454
if you set your div's margin-left:auto and margin-right:auto, would want to...

Example :
Expand|Select|Wrap|Line Numbers
  1. <div style="width:100%; background:green;"><!-- or your width -->
  2.     <div style="width:400px; margin:0 auto; background:red; color: white;">example grid</div>
  3. </div>
  4.  
Jul 30 '12 #2
colinod
347 100+
so would i put the divs that make up my grid in where you have put example grid

thanks
Jul 30 '12 #3
colinod
347 100+
that centres the conatining div but not the items in the grid
Jul 31 '12 #4

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

Similar topics

4
by: metalseb | last post by:
Hi folks I built up a small website which is designed for 800x600 display. Runs just fine in this resolution but if you have a system in 1024 or 1280 pixels wide, the site just "sticks" in the...
10
by: jlub | last post by:
What I'm trying to do is have two different sets of input elements which occupy the same space on the page, only one of which is visible at a time. You switch between the two with a bit of...
2
by: m.pescador | last post by:
Dear all, I'm trying to position two pieces of text in the following way. The two pieces are a few words each and I assume they fit on one line (for now I don't care what happens if they don't)....
6
by: wiewel | last post by:
hi all, i have a strange problem when trying to set up a horizontal menubar: i would like to split the whole screen from left to right into 9 pieces. the first one has a fixed width of 186px....
0
by: John Dalberg | last post by:
using VS 2005. I have an unordered list with list items which are displayed horizontally. Some of the list items have hyper links and some have checkboxes. The problem is that the...
3
by: torbs | last post by:
Strange behaviour in ie7. A collegue of mine put several images into a page using JCE in Joomla. JCE have the option to align these images and he left aligned every single one - to create a...
2
by: lister | last post by:
I want to center a fluid DIV horizontally. I've tried making the margins auto, but this doesn't work. Can anyone help? CSS drives me nuts! demo here:...
4
by: lister | last post by:
I am trying to center a DIV horizonally, but I want the DIV fluid so that it is just wide enough to encompass its contents. I've tried margin:auto with no joy :( I've set up a demo here:...
3
by: sysguy | last post by:
Hello, I have a table with each <td> has four links in it. There are five cells(i.e <td>) like this and requirement is to align them horizontally on a tabbed panel menu bar. The issue is first...
1
KeredDrahcir
by: KeredDrahcir | last post by:
I can't seem to get a DIV tag to center. it works fine in IE8, Firefox, Safari and Google Chrome and is more or less there in Opera. In IE7 (and IE6) I can't seem to get it to work. What I need is...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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.