Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Center nav in content div

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #188577
    Snean
    Participant

    Hey,

    i want to center a nav tag in a div tag, i tried margin, padding and width but nothing worked.

    
    <div class="container">
            
        <!-- nav -->
        <nav id="main-nav">
            <ul>
                <li class="current">
                    <a href="index.html">Start</a>
                </li>
                <li>
                    <a href="#">Page1</a> 
                </li>
                <li>
                    <a href="#">Page2</a>
                </li>
                <li>
                    <a href="#">Events</a>
                </li>
                <li>
                    <a href="#">Page4</a>
                </li>
                    
                </li>
                
            </ul>
        </nav>
        <!-- /nav -->
        </div>
    </header>
    

    CSS

    
    #main-nav { 
        float: right;
        border-right: 1px solid #d6d6d6;
        border-left: 1px solid #b0b0b0;
        z-index: 100;
    }
    
    .container {
        margin: 0 auto;
        position: relative;
        width: 940px;
    }
    
    #188581
    Paulie_D
    Member
    #188589
    Snean
    Participant

    hey,

    i pase now genug code to Codepen.
    The link LINK

    Now you can see left Upcoming Event and on the right side the orange boxes. Like:
    ignore the dots.
    Up…………..[]
    Ev……………[]

    The nav is right and over the [].
    P3|
    ..[]

    I want to move the middle (Center) of the content.
    Like:

    ………|P1|P2|P3|
    Up…………………….[]
    Ev……………………..[]

    thanks!

    #188590
    Paulie_D
    Member

    Please don’t paste an entire webpage and CSS into Codepen…it’s far too much code for us to wade through to find one little thing.

    Remove everything that ISN’T related to your specific issue and try again…thanks!

    #188620
    Snean
    Participant

    OK, i removed much code that is not necessary.

    #188641
    Snean
    Participant

    thanks, with your code, it is in the center.
    I insert it in my site and get this
    After
    Earlier
    http://i62.tinypic.com/29na1pg.png

    On the pic you can see the gap between the brighter part and the border.
    Can i remove it?

    It should look like my old version OLD

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.