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.

Results 1 to 4 of 4
  1. #1
    Junior Member Jimmy Jones's Avatar
    Join Date
    Oct 2012
    Location
    Waxahachie, Texas
    Posts
    20
    Member #
    33137
    Liked
    2 times
    I'm racking my brain trying to figure out how to achieve the following.

    I'm attempting to make the 4 div's center inside the container div, as text-align:center would do with text. I got my full width centered look by using a left margin %, but it's not working good as I resize.

    My problem is when the window shrinks, the divs get off-center, and as I size the window down and they move to below the others, I'd like to have the second row be centered too.

    As an example, on an ipad, the first three are one one row, and the fourth is floated to the position under the first circle. I'd like it to be center!

    Is this even possible?

    TIA!

    Here's the code:

    HTML Code:
    <!doctype html>
    <html>
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <style type="text/css">
    nav {
        margin: auto;
        width: 75%;
        border-bottom: 1px solid #333;
        padding-bottom: 20px;
        max-width: 800px;
    }
    
    .circle {
        width: 100px;
        height: 63px;
        color: #fff;
        background: #333;
        text-align:center;
        border-radius: 50%;
        -webkit-border-radius: 50%;
        -moz-border-radius: 50%;
        padding-top: 37px;
        box-shadow: #888 2px 2px 7px;
        -webkit-box-shadow: #888 2px 2px 7px;
        -moz-box-shadow: 3888 2px 2px 7px;
        font-size: 20px;
        float: left;
        margin-left: 10%;
        margin-top: 10px;
    }
    
    .clearfix {
        clear:both;
    }
    
    </style>
    <title>Untitled Document</title>
    </head>
    
    <body>
    <nav>
    <a href="#"><div class="circle">Link 1</div></a>
    <a href="#"><div class="circle">Link 2</div></a>
    <a href="#"><div class="circle">Link 3</div></a>
    <a href="#"><div class="circle">Link 4</div></a>
    <div class="clearfix"></div>
    </nav>
    </body>
    </html>

  2.  

  3. #2
    Junior Member Jimmy Jones's Avatar
    Join Date
    Oct 2012
    Location
    Waxahachie, Texas
    Posts
    20
    Member #
    33137
    Liked
    2 times
    OK, I figured out a way to do it. I can't make the nav as Div's. I assigned the properties of the divs to the a's and it works, only now they're centered and float correctly, since they're text.

    Thanks to anyone who looked at this and tried to figure it out!

  4. #3
    Senior Member kralcx's Avatar
    Join Date
    Jan 2010
    Location
    3rd Planet from the Sun
    Posts
    140
    Member #
    20799
    Liked
    18 times
    thanks for that...I was looking for an answer

  5. #4
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Definitely a good find. People tend to forget that anchor tags are separate from what contains them.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."


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 09:56 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com