Results 1 to 7 of 7

Thread: Aligning divs

  1. #1
    Join Date
    Jul 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Aligning divs

    Hello everyone,

    I have a problem, obviously.
    It's about aligning divs and how to center them.
    I've looked it up on many many forums but it seems none of those solutions work for me. I think I've got a conflict somewhere but I can't find it.

    First of all, I sliced and auto-coded it with photoshop and then edited the codes. All I want is to have everything centered, mainly the images. I'd rather have the text aligned left. I know this is possible with tables, but how do I do this with divs?

    Another thing, if I add
    Code:
    body {
    	text-align:center;
    	font-family: arial, helvetica, sans-serif;
    	font-size: 80%;
    	color: black;
    	background-color: #000;
    	margin: 1em;
    	padding: 0;
    }
    In my CSS, it doesn't seem to change anything at all. But if I add this in the actual index.html it does.
    I'm doing something wrong, does anyone can point out what exactly?
    Thanks in advance!
    Edit: here's a link for you to look at:
    Last edited by Mirawr; 07-03-2011 at 07:47 PM.

  2. #2
    Join Date
    Jul 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Anyone? I hate double-posting but I really need to work this out, haha

  3. #3
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I don't understand what the problem is on the page you linked to.

    You can read the following article on centering things.
    http://www.w3.org/Style/Examples/007/center

    Also, next time please wait about 24 hours before double posting.
    Jeremy | jfein.net

  4. #4
    Join Date
    Jul 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well, there's a white bar on the right, which indicates that the whole page isn't centered. It's aligned to the left. I want it in the center, then want the bg to be black (which is my second problem because putting:
    Code:
    body {
    	text-align:center;
    	font-family: arial, helvetica, sans-serif;
    	font-size: 80%;
    	color: black;
    	background-color: #000;
    	margin: 1em;
    	padding: 0;
    }
    for the black background doesn't seem to work.

  5. #5
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    In your css file, get rid of the html markup.

    (remove highlighted)

    line 2
    Code:
    /* General Styles */
    <style type="text/css">
    body {
    	text-align:center;
    	font-family: arial, helvetica, sans-serif;
    	font-size: 80%;
    	color: black;
    	background-color: #000;
    	margin: 1em;
    	padding: 0;
    }
    lines 317 + 318
    Code:
    #footer_ {
    	position:absolute;
    	left:0px;
    	top:1196px;
    	width:1200px;
    	height:56px;
    }
     
    -->
    </style>
    Then find the following code:
    Code:
    #Table_01 {
    	position:absolute;
    	left:0px;
    	top:0px;
    	width:1200px;
    	height:1252px;
    }
    And change it to:
    Code:
    #Table_01 {
    	position:relative;
    	margin: -13px auto;
    	width:1200px;
    	height:1252px;
    }
    Jeremy | jfein.net

  6. #6
    Join Date
    Jul 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot, I've been trying to fix that for a few hours now and couldn't fix it.
    You're a hero

  7. #7
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    No problem, I'm glad to help

    In an effort to keep things organized, you have the option to set a thread to resolved when an issue is fixed. To make the status of the thread resolved:
    1. Go to your first post
    2. Edit your first post
    3. Click "Go Advanced"
    4. In the dropdown next to the title, select "RESOLVED"
    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •