Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
Like Tree4Likes

Thread: Centering a div

  1. #1
    Junior Member
    Join Date
    Jan 2015
    Posts
    24
    Member #
    41395
    Liked
    2 times

    Centering a div

    I want center the bottom div that has my websites displayed but dont want the background color going all the way to the edge. If I delete the width: 100%, it shows only what I want to show but will stay to the left.

    I do however have a margin: 0 auto; (top/bottom at 0 & left/right on auto) but will not center.

    http://mast.salemstate.edu/itc18244/...io/index.html#

    #websites {
    margin: 1em auto;
    display:inline-block;
    width: 100%;
    text-align:center;
    background-color: #CCCCCC
    }

  2.  

  3. #2
    Senior Member breno's Avatar
    Join Date
    Feb 2015
    Location
    Australia
    Posts
    138
    Member #
    41574
    Liked
    29 times
    Sorry, i'm not entirely sure what you are asking, are you talking about the footer?

  4. #3
    Junior Member
    Join Date
    Jan 2015
    Posts
    24
    Member #
    41395
    Liked
    2 times
    Look on my portfolio page. you'll see the gray box down below with websites listed, I just want that to be centered.

  5. #4
    Senior Member Vapr_Arts's Avatar
    Join Date
    Oct 2013
    Location
    California
    Posts
    1,930
    Member #
    37412
    Liked
    544 times

    Centering a div

    Do the 100% width like you are now but use a max-width: 1000px; (or whatever size works best)

    This will keep the width at 100% up until it reaches that max width limit

    Regretfully sent from my iPhone using Tapatalk during lunch and other breaks

  6. #5
    Junior Member
    Join Date
    Jan 2015
    Posts
    24
    Member #
    41395
    Liked
    2 times
    Ok, so I set the width: 100% and the an max-width: 500px, but the div isn't centering on the page, just stays on the left side.

  7. #6
    Senior Member Vapr_Arts's Avatar
    Join Date
    Oct 2013
    Location
    California
    Posts
    1,930
    Member #
    37412
    Liked
    544 times
    Oh that is because you have it as an inline-block. Remove that or set it to block and it should work..


    Regretfully sent from my iPhone using Tapatalk during lunch and other breaks

  8. #7
    Senior Member breno's Avatar
    Join Date
    Feb 2015
    Location
    Australia
    Posts
    138
    Member #
    41574
    Liked
    29 times
    Just looking at your code in firebug mate, I think the 'websites' div is nested too far in, take it out of the 'descriptions open' div and have it nested separately in 'content' div, if you know what I mean?

  9. #8
    Junior Member
    Join Date
    Jan 2015
    Posts
    24
    Member #
    41395
    Liked
    2 times
    Actually just needed to add the clear:both property to #websites, and that worked perfectly!

  10. #9
    Senior Member Vapr_Arts's Avatar
    Join Date
    Oct 2013
    Location
    California
    Posts
    1,930
    Member #
    37412
    Liked
    544 times
    Quote Originally Posted by mkymn8828 View Post
    Actually just needed to add the clear:both property to #websites, and that worked perfectly!
    Im glad you figured it out! Sorry i have been a lil out of it lately!


    Regretfully sent from my iPhone using Tapatalk during lunch and other breaks
    mkymn8828 likes this.

  11. #10
    Senior Member breno's Avatar
    Join Date
    Feb 2015
    Location
    Australia
    Posts
    138
    Member #
    41574
    Liked
    29 times
    Quote Originally Posted by mkymn8828 View Post
    Actually just needed to add the clear:both property to #websites, and that worked perfectly!
    eyy, I tried clear:both but it didn't do anything. I'm glad you figured it out, thats good


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:17 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com