Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Center my divs.

  1. #1
    New Coder
    Join Date
    Jun 2013
    Posts
    27
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Center my divs.

    Hello guys,

    I've been searching around on some forums and tried to adjust it on my code but it just doesn't work .
    Probably it's really simple for you out here but help is appreciated big time !

    http://dabblet.com/gist/5805876

    thank you very much !

  • #2
    Regular Coder
    Join Date
    Aug 2012
    Posts
    120
    Thanks
    0
    Thanked 25 Times in 25 Posts
    Change your CSS .container to:

    Code:
    .container{
    	width: 960px;
    	position: relative;
    	left: 0px;
    margin:0 auto;
    }
    Is this what your trying to do?
    1 Corinthians 15:3-4 / Ephesians 2:8-9 - What or Who are you living for?

  • Users who have thanked Brandnew for this post:

    DesignedbyLau (06-18-2013)

  • #3
    New Coder
    Join Date
    Jun 2013
    Posts
    27
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Yup exactly !
    i tried this method on my .main no surprise it didn't work.

    anyways thank you very much for you fast and useful reply !

  • #4
    New Coder
    Join Date
    Jun 2013
    Posts
    27
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Brandnew View Post
    Change your CSS .container to:

    Code:
    .container{
    	width: 960px;
    	position: relative;
    	left: 0px;
    margin:0 auto;
    }
    Is this what your trying to do?
    Still having 1 little issue, i didn't specify before,
    i have my background and such now 100% width set,
    but my divs i've set to a certain width and now it doesn't centre anymore,
    maybe you also know how to solve this?

    here's the code again because of the adjustments
    http://dabblet.com/gist/5807913

  • #5
    Regular Coder
    Join Date
    Aug 2012
    Posts
    120
    Thanks
    0
    Thanked 25 Times in 25 Posts
    i fiddled with your CSS a little bit and though i wasn't able to get the exact image i think this may get you on the right direction.

    Update the following class and id:
    Code:
    .logo{
    	top:0px;
    	
    	margin:0 auto;
    	width: 1300px;
    	height:1240px;
    	padding: 0px 0;
    	
    	position: relative;
    	overflow: hidden;
    
    	-webkit-box-sizing: content-box;
    	-moz-box-sizing: content-box;
    	box-sizing: content-box;
    }
    Code:
    #content-2{
    	top:px;
    	float:left;
    	margin:0 auto;
    	width: 100%;
    	height: 1300px;
    	padding: 0px 0;
    	margin: 0 auto;
    	position: relative;
    	overflow: hidden;
    	background-color:#FFF;
    	
    	z-index:-1;
    	-webkit-box-sizing: content-box;
    	-moz-box-sizing: content-box;
    	box-sizing: content-box;
    }
    This does cause your div's to center however the background shows up on the bottom. Without looking at every css code step by step, hopefully this will lead you to the right solution.

    hope this helps
    1 Corinthians 15:3-4 / Ephesians 2:8-9 - What or Who are you living for?

  • #6
    New Coder
    Join Date
    Jun 2013
    Posts
    27
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thank you for your reply,
    indeed the divs are centered now ! thank you very much.
    the background i will mess around a bit, somehow the float:left;
    keeps it in it's position but will figure out,

    thanks alot !


  •  

    Posting Permissions

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