Cannot center the elements in the navbar - html

I'm sorry to ask this question because it has been largely posted, but I checked a lot of links and didn't solve it yet. I have a navbar with 2 elements and I cannot center it in the middle of the nav.
#menu {
background: #000000;
background: linear-gradient(to bottom, #973F8E, #DC4069);
color: #FFF;
height: 52px;
width: 500px;
padding-left: 18px;
border-radius: 50px;
border: 1px solid #000000;
margin: auto;
display:block;
text-align:center !important;
}
#menu ul, #menu li {
margin: 0 auto;
padding: 0;
list-style: none;
display: block;
text-align: center;
}
#menu ul {
width: 100%;
}
#menu li {
float: left;
display: inline;
position: relative;
}
#menu a {
display: block;
line-height: 50px;
padding: 0 14px;
text-decoration: none;
color: #FFFFFF;
font-size: 15px;
text-transform: uppercase;
}
#menu a.dropdown-arrow:after {
content: "\25BE";
margin-left: 5px;
}
#menu li a:hover {
color: #000000;
background: #FFA6AF;
}
#menu input {
display: none;
margin: 0;
padding: 0;
height: 52px;
width: 100%;
opacity: 0;
cursor: pointer
}
#menu label {
display: none;
line-height: 50px;
text-align: center;
position: absolute;
left: 35px
}
#menu label:before {
font-size: 1.6em;
content: "\2261";
margin-left: 20px;
}
#menu ul.sub-menus{
height: auto;
overflow: hidden;
width: 170px;
background: #444444;
position: absolute;
z-index: 99;
display: none;
}
#menu ul.sub-menus li {
display: block;
width: 100%;
}
#menu ul.sub-menus a {
color: #FFFFFF;
font-size: 16px;
}
#menu li:hover ul.sub-menus {
display: block
}
#menu ul.sub-menus a:hover{
background: #F2F2F2;
color: #444444;
}
<nav id="menu">
<input type='checkbox' id='responsive-menu' onclick='updatemenu()'><label></label>
<ul>
<li><a href='/'>DASHBOARD</a></li>
<li><a href='/model'>MODEL</a></li>
</ul>
</nav>
Probably in the large number of css elements I'm not able to see where the code is not working.
I posted the code here:
codepen

You should remove the left padding from the main #menu element, set the ul's display to inline-block and the width to auto (just remove the width property).
This will work because the #menu element has text-align: center. the ul will be centered since its width is not 100% (because width is set to auto and the display to inline-block).
#menu {
background: #000000;
background: linear-gradient(to bottom, #973F8E, #DC4069);
color: #FFF;
height: 52px;
width: 500px;
padding-left: 0; // remove this
border-radius: 50px;
border: 1px solid #000000;
margin: auto;
display:block;
text-align:center !important;
}
#menu ul, #menu li {
margin: 0 auto;
padding: 0;
list-style: none;
display: block;
text-align: center;
}
#menu ul {
display: inline-block; // and set this
}
#menu li {
float: left;
display: inline;
position: relative;
}
#menu a {
display: block;
line-height: 50px;
padding: 0 14px;
text-decoration: none;
color: #FFFFFF;
font-size: 15px;
text-transform: uppercase;
}
#menu a.dropdown-arrow:after {
content: "\25BE";
margin-left: 5px;
}
#menu li a:hover {
color: #000000;
background: #FFA6AF;
}
#menu input {
display: none;
margin: 0;
padding: 0;
height: 52px;
width: 100%;
opacity: 0;
cursor: pointer
}
#menu label {
display: none;
line-height: 50px;
text-align: center;
position: absolute;
left: 35px
}
#menu label:before {
font-size: 1.6em;
content: "\2261";
margin-left: 20px;
}
#menu ul.sub-menus{
height: auto;
overflow: hidden;
width: 170px;
background: #444444;
position: absolute;
z-index: 99;
display: none;
}
#menu ul.sub-menus li {
display: block;
width: 100%;
}
#menu ul.sub-menus a {
color: #FFFFFF;
font-size: 16px;
}
#menu li:hover ul.sub-menus {
display: block
}
#menu ul.sub-menus a:hover{
background: #F2F2F2;
color: #444444;
}

You can use flex positions.
Use property justify-content : center to center all children div inside a parent div. It's useful to distribute the space between or around the elements.
This will also make your CSS code lighter. The more CSS, the more difficult it is.
It's also good for responsive design.
I have also removed some CSS property. This code can be further improved and reduced. Good luck !
#menu {
background: #000000;
background: linear-gradient(to bottom, #973F8E, #DC4069);
color: #FFF;
height: 52px;
width: 500px;
// padding-left: 18px;
border-radius: 50px;
border: 1px solid #000000;
margin: auto;
// display:block;
// text-align:center !important;
}
#menu ul, #menu li {
margin: 0 auto;
padding: 0;
// list-style: none;
// display: block;
text-align: center;
}
#menu ul {
width: 100%;
display: flex;
justify-content: center;
}
#menu li {
// float: left;
margin : 0px;
display: inline;
// position: relative;
}
#menu a {
display: block;
line-height: 51px;
padding: 0 14px;
text-decoration: none;
color: #FFFFFF;
font-size: 15px;
text-transform: uppercase;
}
#menu a.dropdown-arrow:after {
content: "\25BE";
margin-left: 5px;
}
#menu li a:hover {
color: #000000;
background: #FFA6AF;
}
#menu input {
display: none;
margin: 0;
padding: 0;
height: 52px;
width: 100%;
opacity: 0;
cursor: pointer
}
#menu label {
display: none;
line-height: 50px;
text-align: center;
position: absolute;
left: 35px
}
#menu label:before {
font-size: 1.6em;
content: "\2261";
margin-left: 20px;
}
#menu ul.sub-menus{
height: auto;
overflow: hidden;
width: 170px;
background: #444444;
position: absolute;
z-index: 99;
display: none;
}
#menu ul.sub-menus li {
display: block;
width: 100%;
}
#menu ul.sub-menus a {
color: #FFFFFF;
font-size: 16px;
}
#menu li:hover ul.sub-menus {
display: block
}
#menu ul.sub-menus a:hover{
background: #F2F2F2;
color: #444444;
}
<nav id="menu">
<input type='checkbox' id='responsive-menu' onclick='updatemenu()'><label></label>
<ul>
<li><a href='/'>DASHBOARD</a></li>
<li><a href='/model'>MODEL</a></li>
</ul>
</nav>

Related

how to make li of ul width stretch the whole screen

I was wondering but I have been spending a lot of time trying to find a way to make my li from my ul stretch across but I seem not to be able to do it. It's very similar to the nav bar of This website and This website.I am asking if someone can help me with this.
Thank you. Best I can provide is a basic nav hover bar
.dropdown-btn {
width: 100%;
height: 50px;
background: white;
line-height: 50px;
display: none;
}
nav {
width: 100%;
height: 50px;
background-color: #d60d8c;
margin-bottom: 1px;
position: sticky;
top: 0;
padding: 0px 0px;
border: none;
}
ul {
text-indent: 0px;
}
nav:hover {
height: 50px;
}
.navbar-tab {
display: block;
}
.hover-list {
position: absolute;
}
.navbar-tab-1 {
background: #d60d8c;
float: left;
border: none;
}
.navbar-tab-1+.navbar-tab-1 {
border-bottom: none;
}
.hover-list {
border-top: black 3px solid;
}
.navbar-tab {
padding-left: 20px;
display: block;
}
.navbar-tab {
max-width: 1240px;
}
.navbar-tab-1 {
padding-right: 68px;
width: auto;
}
.hover-list li {
background-color: #e2e2e2;
border-bottom: 1px white solid;
font-size: 15px;
text-indent: 20px;
height: 35px;
line-height: 35px;
width: 100vw;
border-top: none;
float: left;
}
ul li ul li {
display: block;
}
ul li {
font-size: 19px;
}
ul {
padding: 0px;
list-style: none;
font-family: arial;
margin: auto;
}
.navbar-tab-1:hover {
color: black;
transition-duration: .2s;
}
ul li {
font-family: 'Raleway', sans-serif;
font-weight: 400;
line-height: 50px;
list-style: none;
}
ul li a {
text-decoration: none;
color: black;
}
ul li ul li{
display: none;
transition-duration:
}
.hover-list li:hover{
background-color: #f5f5f0;
transition-duration: .2s;
}
<nav id="navbar">
<div class="dropdown-btn">Go To...</div>
<ul class="navbar-tab">
<li class="navbar-tab-1 selected">Test1</li>
<li class="navbar-tab-1 select">
Test2
<ul class="hover-list select">
<li>Item1</li>
</ul>
</li>
</ul>
</nav>
Maybe something you are looking for
body {
margin:0;
}
.dropdown-btn {
width: 100%;
height: 50px;
background: white;
line-height: 50px;
display: none;
}
nav {
width: 100%;
height: 50px;
background-color: #d60d8c;
margin-bottom: 1px;
position: sticky;
top: 0;
padding: 0px 0px;
border: none;
}
ul {
padding-left: 0;
position: relative;
list-style: none;
margin-bottom: 0;
}
nav:hover {
height: 50px;
}
.navbar-tab {
display: block;
}
.hover-list {
position: fixed;
max-height: 0;
transition: max-height 1s;
padding: 0;
width: 100vw;
overflow: hidden;
left: 0;
top: 66px;
}
.hover-list > li {
width: 100%;
}
.navbar-tab-1 {
background: #d60d8c;
float: left;
border: none;
}
.navbar-tab-1+.navbar-tab-1 {
border-bottom: none;
}
.navbar-tab {
padding-left: 20px;
display: block;
}
.navbar-tab {
max-width: 1240px;
}
.navbar-tab-1 {
padding-right: 68px;
width: auto;
}
.hover-list li {
background-color: #e2e2e2;
border-bottom: 1px white solid;
font-size: 15px;
text-indent: 20px;
height: 35px;
line-height: 35px;
border-top: none;
float: left;
}
ul li ul li {
display: block;
}
ul li {
font-size: 19px;
}
ul > li:hover ul {
max-height: 500px;
}
<nav id="navbar">
<div class="dropdown-btn">Go To...</div>
<ul class="navbar-tab">
<li class="navbar-tab-1 selected">Test1</li>
<li class="navbar-tab-1 select">Test2
<ul class="hover-list select">
<li><a>Item1</a></li>
</ul>
</li>
</ul>
</nav>

Dropdown navigation Menu without using fixed height?

This is a simple dropdown navigation menu. The problem here that the dropdown menu doesn't appear if i don't give it a fixed height. Is there a way to make it appear without giving it a fixed height? And if there any other modifications or ameliorations that can be useful please tell me. Thank you.
HTML:
<nav>
<ul class="mainmenu">
<li>Browsers
<div class="submenubig">
<div class="submenusmall Browsers">
<ul>
<li><span>Top Browsers</span>
<ul class="topbrowsers">
<li>Firefox</li>
<li>Chrome</li>
<li>Safari</li>
<li>Opera</li>
<li>Edge</li>
</ul>
</li>
<li><span>Other Browsers</span>
<ul class="otherbrowsers">
<li>Dooble</li>
<li>Coowon</li>
<li>Blackhawk</li>
<li>Beamrise</li>
<li>NetGroove</li>
</ul>
</li>
</ul>
</div>
</div>
</li>
</ul>
</nav>
CSS:
*{
box-sizing: border-box;
font-family: Arial;
}
nav{
border: 5px solid orange;
height: 1000px;
}
ul{
list-style: none;
padding: 0;
}
.mainmenu{
margin: 20px auto;
display: table;
width: 1000px;
position: relative;
background-color: #1E1E1E;
}
.mainmenu > li{
display: table-cell;
}
a{
display: block;
width: 100%;
height: 100%;
text-align: center;
text-decoration: none;
text-transform: uppercase;
}
.mainmenu > li > a{
font-size: 1.3em;
padding: 0;
color: white;
letter-spacing: 0.1em;
}
.mainmenu > li > a:hover{
color: aqua;
}
.mainmenu > li:hover .submenubig{
border-bottom: 5px solid yellow;
max-height: 1000px;
}
.submenubig{
overflow: hidden;
position: absolute;
left: 0;
width: 100%;
transition: 0.2s all ease-in;
max-height: 0px;
background: #555;
}
.submenusmall a:hover{
color: yellow;
text-decoration: underline;
}
/*--------------------------------------------------*/
span{
font-size: 1.3em;
display: block;
text-align: center;
color: burlywood;
letter-spacing: 0.1em;
}
.submenusmall{
padding-top: 20px;
padding-left: 60px;
}
.submenusmall a{
color: white;
font-size: 1.1em;
letter-spacing: 0.1em;
}
.submenusmall > ul{
height: 190px;
/*This is what i'm talking about*/
}
.submenusmall > ul > li{
position: relative;
float: left;
padding: 0 10px;
color: white;
margin-right: 90px;
text-transform: uppercase;
letter-spacing: 0.1em;
}
.topbrowsers{
position: absolute;
left: 0;
width: 100%;
top: 45px;
padding: 0;
}
.topbrowsers li{
display: block;
width: 100%;
border-bottom: 1px solid grey;
}
.otherbrowsers{
position: absolute;
width: 100%;
left: 0;
top: 45px;
padding: 0;
}
.otherbrowsers li{
display: block;
width: 100%;
border-bottom: 1px solid grey;
}
I think the problem is that the unordered lists with the .topbrowsers and .otherbrowsers classes are set with position absolute:
The element is removed from the normal document flow; no space is
created for the element in the page layout.
You could try this:
*{
box-sizing: border-box;
font-family: Arial;
}
nav{
border: 5px solid orange;
height: 1000px;
}
ul{
list-style: none;
padding: 0;
}
.mainmenu{
margin: 20px auto;
display: table;
width: 1000px;
position: relative;
background-color: #1E1E1E;
}
.mainmenu > li{
display: table-cell;
}
a{
display: block;
width: 100%;
height: 100%;
text-align: center;
text-decoration: none;
text-transform: uppercase;
}
.mainmenu > li > a{
font-size: 1.3em;
padding: 0;
color: white;
letter-spacing: 0.1em;
}
.mainmenu > li > a:hover{
color: aqua;
}
.mainmenu > li:hover .submenubig{
border-bottom: 5px solid yellow;
max-height: 1000px;
}
.submenubig{
overflow: hidden;
position: absolute;
left: 0;
width: 100%;
transition: 0.2s all ease-in;
max-height: 0px;
background: #555;
}
.submenusmall a:hover{
color: yellow;
text-decoration: underline;
}
/*--------------------------------------------------*/
span{
font-size: 1.3em;
display: block;
text-align: center;
color: burlywood;
letter-spacing: 0.1em;
}
.submenusmall{
padding-top: 20px;
padding-left: 60px;
}
.submenusmall a{
color: white;
font-size: 1.1em;
letter-spacing: 0.1em;
}
.submenusmall > ul{
// height: 190px;
/*This is what i'm talking about*/
}
.submenusmall > ul > li{
position: relative;
float: left;
padding: 0 10px;
color: white;
margin-right: 90px;
text-transform: uppercase;
letter-spacing: 0.1em;
}
.topbrowsers{
// position: absolute;
// left: 0;
width: 100%;
// top: 45px;
padding: 30px 0;
}
.topbrowsers li{
display: block;
width: 100%;
border-bottom: 1px solid grey;
}
.otherbrowsers{
// position: absolute;
width: 100%;
// left: 0;
// top: 45px;
padding: 30px 0;
}
.otherbrowsers li{
display: block;
width: 100%;
border-bottom: 1px solid grey;
}

How to display (<li>) menu items over divs - z-index not working

I am using a ul & li a bit like a select dropdown to trigger a JS function (not shown).
It's working fine - except the menu items appear BEHIND divs that are shown below them.
I've mocked up the problem here: http://jsfiddle.net/bf8ugef7/1/
I'm fiddling with z-index and position:absolute but can't see how to make it work.
Can anyone help?
Here is the HTML and CSS:
body {
font-family: sans-serif;
color: gray;
font-weight: 100;
}
div, li {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
li {
color: #333333;
text-decoration: none;
/* background-image: url("images/mullion.gif"); */
}
div.images {
border: 1px solid #555555;
/* padding-left: 5px; */
width: 100%;
float: left;
clear: left;
margin-bottom: 20px;
/*
background-image: url("images/iMullion.gif");
background-repeat: no-repeat;
*/
}
div.lowerText {
width: 100%;
}
div.btn {/* +filter */
float: right;
width: 195px;
cursor: default;
text-align: right;
/* margin-left: 1px; */
display: inline-block;
}
div.btn1 {
float: left;
width: 153px;
cursor: default;
text-align: center;
margin-left: 1px;
display: inline-block;
position: absolute;
color: black;
background-color: #79c1ee;
left: 182px;
}
div.btn2 {
float: left;
width: 20px;
display: inline-block;
color: white;
font-weight: 100;
text-align: center;
background-color: white;
cursor: default;
position: absolute;
left: 162px;
z-index: 100;
}
div.btn2 ul {
list-style: none;
position: absolute;
display: block;
margin: 0px;
padding: 0px;
z-index: 100;
}
div.btn2 ul li {
display: none;
cursor: pointer;
color: white;
height: 25px;
background-color: #79c1ee;
margin-top: 1px;
z-index: 100;
}
div.btn2 ul li:first-child {
margin-top: 0px;
display: inline-block;
width: 20px;
z-index: 100;
}
div.btn2 ul:hover {
height: 200px;
}
div.btn2 ul:hover li {
display: block;
z-index: 100;
}
div.btn2 ul li:hover {
background-color: #13A3E2;
z-index: 100;
}
/*
div.btn2 ul li:hover {
display: block;
width: 20px;
height: 100px;
}
*/
div.btn3 {
margin-left: 1px;
float: left;
width: 20px;
display: inline-block;
vertical-align: top;
text-align: center;
font-weight: 400;
color: white;
background-color: #13A3E2;
position: absolute;
left: 336px;
cursor: pointer;
}
div.btn3:hover {
background-color: red;
}
div.btn4 {
/* border: 1px solid black; */
padding-left: 5px;
float: left;
width: 153px;
display: inline-block;
color: #444444;
cursor: default;
background-color: white;
}
div.attr {
padding-left: 5px;
color: #444444;
background-color: #79C1ED;
float: right;
clear: none;
display: inline-block;
text-align: left;
}
div.filters {
width: 100%;
line-height: 1.8;
overflow: hidden;
display: block;
font-size: 14px;
text-decoration: none;
float: left;
}
div.toptext {
line-height: 2.2;
display: block;
max-height: 35px;
color: #444444;
background-color: #555555;/* matches border color */
color: white;
width: 100%;
padding-left: 5px;
cursor: not-allowed;
/* border: 1px solid pink; */
}
div.leftnav {
width: 350px;
float: left;
clear: left;
}
div#container {
padding: 0px;
margin: 0px;
}
<div class="leftnav">
<div class="images">
<div class="toptext">Filters
<div class="btn">+ filter</div>
</div>
<div id="container">
<div class="filters rem" id="f12">
<div class="btn4" id="b4f12">Pupil name</div>
<div class="btn2" id="b2f12">
<ul>
<li id="ddf_12_0">=</li>
<li id="ddf_12_1">></li>
</ul>
</div>
<div class="btn1" id="b1f12">Joe Bloggs</div>
<div class="btn3" id="if12">x</div>
</div>
<div class="filters rem" id="f13">
<div class="btn4" id="b4f13">Pupil name</div>
<div class="btn2" id="b2f13">
<ul>
<li id="ddf_13_0">=</li>
<li id="ddf_13_1">></li>
</ul>
</div>
<div class="btn1" id="b1f13">Bill Clinton</div>
<div class="btn3" id="if13">x</div>
</div>
</div>
</div>
</div>
Thanks
Emma
Try this code:
div.btn2 {
float: left;
width: 20px;
display: inline-block;
color: white;
font-weight: 100;
text-align: center;
background-color: white;
cursor: default;
left: 162px;
}
div.btn2 ul {
display: block;
margin: 0;
padding: 0;
}
div.btn2 ul li {
display: none;
cursor: pointer;
color: white;
height: 25px;
background-color: #79c1ee;
}
div.btn2 ul li:first-child {
display: inline-block;
border-top: none;
width: 20px;
}
div.btn2:hover li {
display: block;
position: absolute;
width: 20px;
border-top: 1px solid #fff;
}
div.btn2:hover li:first-child {
position: relative;
}
div.btn2 ul li:hover {
background-color: #13A3E2;
}
# Claudiu Yes it should be comment, but i dont have enough points to add comments
div.btn2 {
width: 20px;
display: inline-block;
color: white;
font-weight: 100;
text-align: center;
cursor: pointer;
left: 162px;
}
div.btn2 ul {
display: block;
margin: 0;
padding: 0;
}
div.btn2 ul li {
display: none;
cursor: pointer;
color: white;
height: 25px;
background-color: #79c1ee;
}
div.btn2 ul li:first-child {
display: inline-block;
width: 20px;
}
div.btn2:hover li {
display: block;
position: absolute;
width: 20px;
background: #000;
}
div.btn2:hover li:first-child {
position: relative;
}
div.btn2 ul li:hover {
background-color: #13A3E2;
}
i have updated the fiddle

Why am I missing a section?

So here's what I should be getting
But this is what I'm getting
As you can see the yellow section is missing. Here's my working example http://jsfiddle.net/Qk543/ but for some weird reason I cannot replicate it. Here's my code for the defective page.
<div class="wrap">
<div class="foot">
<ul class="styl">
<a id="html" href="#">
<li style="background: #F16529">
WORD
</li>
</a>
<a id="css" href="#">
<li style="background: #2AA9E0">
WORD
</li>
</a>
<a id="php" href="#">
<li style="background: #8892BF">
WORD
</li>
</a>
<a id="js" href="#">
<li style="background: #F0DB4F">
WORD
</li>
</a>
</ul>
</div>
</div>
And the CSS to it...
h1 {
padding: 80px 0 40px;
font-size: 40px;
line-height: 48px;
color: #505762;
}
.search h1 {
padding: 60px 0;
}
.slidey {
overflow: hidden;
padding: 30px 0;
background: #f3f5f8;
border-bottom: 1px solid #e5e8ed;
}
.js-enabled .slidey {
-webkit-transition: margin-top .2s;
-moz-transition: margin-top .2s;
transition: margin-top .2s;
}
.slidey b, .slidey label {
display: block;
font-weight: 500;
padding-bottom: 15px;
font-size: 15px;
font-weight: 500;
}
.slidey form, .slidey aside {
float: left;
width: 50%;
}
.slidey form input {
padding: 20px;
width: 75%;
}
.slidey li {
list-style: none;
}
.slidey a {
display: block;
text-decoration: none;
color: #717985;
}
.slidey a:hover {
color: #414b59;
}
.slidey li span {
float: right;
opacity: .6;
}
#top {
overflow: hidden;
padding: 20px 35px;
background: #fff;
border-bottom: 1px solid rgba(22,36,54,.1);
}
#top a {
float: left;
font-size: 13px;
font-weight: 500;
text-decoration: none;
color: #8895a7;
}
#top #logo:hover, #top ul a:hover, #top ul .active a, .posts .items li:first-child h2 a:hover, p a:hover {
color: #4171b1;
}
#top ul {
list-style: none;
float: right;
}
#top ul li {
float: left;
padding-left: 40px;
}
#top ul a {
display: inline-block;
color: #555f6d;
}
#top ul img {
display: inline-block;
vertical-align: middle;
position: relative;
top: -2px;
width: 16px;
height: 16px;
opacity: .4;
}
#top ul a:hover img {
opacity: .7;
}
#top ul a.active img {
opacity: 1;
}
/**
* Index page listing, category listing, search page results
*/
.items {
list-style: none;
}
.items > li {
padding: 70px 0 60px;
color: #97aec9;
background: #3c4552;
}
.posts .items > li:first-child {
background: #fff !important;
padding: 110px 0;
}
.items li h1 a, .posts .items > li:first-child h2 a {
color: #3d4551;
}
.items h1 {
padding: 0 0 8px;
}
.items h1 a {
text-decoration: none;
}
.items h2 {
font-size: 32px;
line-height: 41px;
}
.items h2 a {
display: block;
padding-bottom: 12px;
color: #fff;
color: rgba(176,200,236,.8);
text-decoration: none;
}
.items h2 a:hover {
color: #fff;
}
.items .content {
padding: 10px 0 0;
}
.items .content p {
padding-bottom: 15px;
}
/**
* Pagination
*/
.pagination {
overflow: hidden;
padding: 30px 0;
margin-bottom: 50px;
border-top: 1px solid rgba(22,36,54,.1);
border-bottom: 1px solid rgba(22,36,54,.1);
}
.pagination:empty {
display: none;
}
.pagination a {
float: left;
text-decoration: none;
font-size: 13px;
font-weight: 500;
color: #6f7b8b;
}
.pagination a:hover {
color: #3c4857;
}
.pagination a.next {
float: right;
}
/**
* Give some extra space to single-page wrappers
*/
.content.wrap {
padding-bottom: 50px;
}
.content.wrap ul, .content.wrap ol, .items li ul {
padding: 20px 30px;
}
.content.wrap ul ul, .content.wrap ol ol, .items li ul ul {
padding: 0 20px;
}
/**
* Footnotes and straplines
*/
.footnote, .commentlist time, .items footer {
display: block;
padding: 5px 0 15px;
color: #98a2b1;
font-size: 14px;
font-style: italic;
white-space: nowrap;
}
.footnote {
padding: 20px 0 40px;
}
/**
* Comment form
*/
ul.commentlist {
margin-bottom: 40px;
list-style: none;
border-top: 1px solid rgba(22,36,54,.1);
}
ul.commentlist .wrap {
position: relative;
}
ul.commentlist li {
padding: 40px 0;
border-bottom: 1px solid rgba(22,36,54,.1);
}
ul.commentlist time {
font-size: 13px;
}
ul.commentlist h2 {
font-size: 25px;
line-height: 33px;
}
ul.commentlist .counter {
position: absolute;
right: 0;
top: 0;
font-size: 25px;
font-weight: 300;
color: #cdd2da;
}
#comment {
overflow: hidden;
}
#comment label[for] {
display: none;
}
#comment p {
float: left;
width: 48%;
margin-right: 4%;
margin-bottom: 10px;
text-indent: 0;
}
#comment p + p {
margin-right: 0;
}
#comment p.textarea {
float: none;
width: 100%;
}
#comment input, #comment textarea {
width: 100%;
padding: 10px 15px;
font-size: 15px;
font-weight: normal;
border: 1px solid rgba(22,36,54,.2);
border-radius: 4px;
}
#comment input:focus, #comment textarea:focus {
outline: none;
background: #f7f9fc;
}
#comment textarea {
min-height: 150px;
max-height: 800px;
resize: vertical;
}
#comment button {
display: inline-block;
padding: 9px 18px;
background: #4e82ce;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 13px;
font-weight: 500;
}
#comment button:hover {
background: #3c6eb7;
}
*{padding:0;margin:0;}
body {
text-align: center;
padding-top: 50px;
font-family: "Helvetica Neue", sans-serif;
}
.foot{
bottom: 0px;
position: fixed;
width:100%;
margin: 0px;
font-weight: 400;
}
.foot li{
opacity: 0.95;
position: relative;
float: left;
list-style: none;
width: 25%;
height: 60px;
text-align: center;
}
.foot a{
font-size: 1.5em;
color: #fff;
height: 75px;
position: relative;
text-indent: 0;
text-decoration: none;
line-height: 60px;
}
.foot li:nth-child(1){
background: #B36C4E;
}
.foot li:nth-child(2){
background: #2AA9E0;
}
.foot li:nth-child(3){
background: #8892BF;
}
.foot li:nth-child(4){
background: #F0DB4F;
}
a:link{text-decoration: none}
a:hover{text-decoration: none}
a:visited{text-decoration: none}
a:active{text-decoration: none}
.content {
padding-right: 5%;
padding-left: 5%;
}
Any ideas?
You're using floats, so there's a good chance your last element is a pixel or so too wide for the container it's in and it's floating to the next line.
Try changing the width to 24% on each element and you'll probably see all four.
If you don't want to play with the width, try adding this to your css:
* {
box-sizing: border-box;
}
That includes any padding/margin in the width so that 25% width will be the true width instead of 25% plus padding/margin.

List style menu is not displaying in line

Here you can see the code: http://jsfiddle.net/LQSK3/1/
I can't get display: inline; working there for every li element.
Also got the problem width the line.png image, as it's height is the same as the font height, I want it to has 35px height with margin left and right set to 5px.
Where is the problem?
You need to update your style sheet. Please add this new style:
#menu {
position: relative;
clear: both;
top: -3px;
background-color: coral;
border: 1px solid black;
width: 800px;
height: 35px;
float:left;
}
li { display: inline;float:left; }
#menu ul {
position: absolute;
font-family: Century Gothic, sans-serif;
font-size: 14px;
list-style-type: none;
padding: 0;
margin: 9px 0 0 123px;
width: 649px;
height: 39px;
color: #FFF;
float:left;
}
a { font-weight: bold; color: red; text-decoration: none; }
a:hover { text-decoration: underline; }
#menu a {
background: url('http://i.imgur.com/rzNj0.png') top right no-repeat;
width: 65px;
height: 18px;
float: left;
margin: 0px 5px;
}
You need to add float: left; to menu div,ul,li and a . Also should set width and height and margin of the a tag.
Here is a working sample : http://jsfiddle.net/YjeBs/
Hope this helps :)
EDIT:
If you want your line to extend from top to bottom of the menu div you can change your styles to:
#menu {
position: relative;
clear: both;
top: -3px;
background-color: coral;
border: 1px solid black;
width: 800px;
height: 35px;
float:left;
}
li {
float: left;
height: 35px;
display:inline;
}
#menu ul {
color: #FFFFFF;
float: left;
font-family: Century Gothic,sans-serif;
font-size: 14px;
height: 35px;
list-style-type: none;
margin: 0 0 0 123px;
padding: 0;
position: absolute;
width: 649px;
}
a { font-weight: bold; color: red; text-decoration: none; }
a:hover { text-decoration: underline; }
#menu a {
background: url("http://i.imgur.com/rzNj0.png") no-repeat scroll right top transparent;
float: left;
height: 29px;
margin: 0 5px;
padding-top: 8px;
width: 65px;
}
Hope this is you want :)
just change li { diplay: inline; } with li { display: inline; } it works.