Nav bar not center of the page

Permalink
Hello,


I am trying to center the grey nav bar on this page:http://lineardynamics.com.au/index.php...

I tried many different ways but could not find what I wanted.

I am using latest Concrete5.

Here's the codes

CSS:
<style>
nav ulC {
-webkit-font-smoothing:antialiased;
text-shadow:0 1px 0 #FFF;
background: #ddd;
list-style: none;
margin: 0;
padding: 0;
width: 800px;
display:inline;
}
navC liC {
float: left;
margin: 0;
padding: 0;
position: relative;
min-width: 200px;
}
navC a {
background: #ddd;
color: #444;
display: block;
font: bold 16px/50px sans-serif;
padding: 0 25px;
text-align: center;
text-decoration: none;
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
navC .dropdown:after {
content: ' ▶';
}
navC .dropdown:hover:after{
content:'\25bc'
}
navC liC:hover a {
background: #ccc;
}
navC liC ulC {
width: 200px;
float: left;
left: 0;
opacity: 0;
position: absolute;
top: 35px;
visibility: hidden;
z-index: 1;
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
navC liC:hover ulC {
opacity: 1;
top: 50px;
visibility: visible;
width: 200px;
}
nav liC ulC liC {
float: none;
width: 200px;
}
nav liC ulC a:hover {
background: #bbb;
width: 200px;
}

/* Clearfix */

.cf:after, .cf:before {
content:"";
display:table;
}
.cf:after {
clear:both;
}
.cf {
zoom:1;
}​
</style>


HTML:
<navC>
<ulC class="cf">
<liC><a class="dropdown" href="#">Linear Actuators</a>
<ulC>
<liC><a href="#">Moteck</a></liC>
<liC><a href="#">Hiwin</a></liC>
<liC><a href="#">Dyadic Systems</a></liC>
</ulC>
</liC>
<liC><a class="dropdown" href="#">Rotary Tables</a>
<ulC>
<liC><a href="#">Apex Dynamics</a></liC>
<liC><a href="#">Orential Motor</a></liC>
</ulC>
</liC>
<liC><a class="dropdown" href="#">Stepper Systems</a>
<ulC>
<liC><a href="#">Orential Motor</a></liC>
</ulC>
</liC>
<liC><a class="dropdown" href="#">CNC Machines</a>
<ulC>
<liC><a href="#">Hiwin</a></liC>
<liC><a href="#">Apex Dynamics</a></liC>
</ulC>
</liC>
<liC><a class="dropdown" href="#">Industrial Robots</a>
<ulC>
<liC><a href="#">Hiwin</a></liC>
<liC><a href="#">Apex Dynamics</a></liC>
</ulC>
</liC>
<liC><a class="dropdown" href="#">Tracking Systems</a>
<ulC>
<liC><a href="#">Moteck</a></liC>
<liC><a href="#">Joyce Dayton</a></liC>
<liC><a href="#">Hiwin</a></liC>
</ulC>
</liC>
</ulC>
</navC>

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi VictorDynaC5,

I recommend reviewing this article on centering:
https://css-tricks.com/centering-css-complete-guide/...

To make the navigation stack and order evenly on smaller screen sizes, you will need to use media queries to conditionally apply CSS.

I also recommend this article:
http://learnlayout.com/
siton replied on at Permalink Reply
siton
Learn The center issue by the tuts above.

PROBLEM 1: Your styles are wrong + your markup not valid ("<ulc>?!!"--> change to <ul class="my-center-class">
Than use selectors to style this (.my-center-class: or more specific nav .my...)
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_start...
http://code.tutsplus.com/tutorials/the-30-css-selectors-you-must-me...

PROBLEM 2: You add to much styles and markup for "build in" boostrap styles.
Step 1 - Create div or nav (display block by deafult) + add BG color (to get full width color strip - you also can use nav navbar)

Step 2 - Put inside this div continater. You dont need to align center the container (it already align center by CSS build in styles).

Simple example:
https://getbootstrap.com/examples/starter-template/...
-----------
If you want also to align the ul list again search first at bootstrap CSS (the align will be now relative to the container)
EXMAPLE:
https://getbootstrap.com/examples/starter-template/...

****
Also learn about the diff between display: inline / block / inline-block (youtube or google)

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.