I want to make this navigation that it looks like in tiled format. But here some white spaces coming at the end of the one row. Is it possible to make it form like a border surrounded by navigation & inside it navigation looks like proper tiles instead of some white space..
My Code..
.nav {
width: 960px;
margin: 50px auto;
border: 1px solid #06c;
display: table
}
.nav ul {
padding: 0;
margin: 0
}
.nav ul li {
list-style: none;
float: left;
border: 1px solid #06C;
font-family: Swis721 Cn BT;
font-weight: bold;
display: block
}
.nav ul li a {
text-decoration: none;
color: #06C;
padding: 10px 20px 10px 12px;
display: block
}
.nav ul li a:hover {
color: #fff;
background: #06c
}
<div class="nav">
<ul>
<li>ALL
</li>
<li>AGENCY
</li>
<li>AUTOMOBILES
</li>
<li>BANKING
</li>
<li>CONSUMER DURABLE & FMCG
</li>
<li>CONSULTING
</li>
<li>EDUCATIONAL
</li>
<li>FINANCIAL SERVICES
</li>
<li>HOSPITALITY
</li>
<li>INFRASTRUCTURE & REAL ESTATE
</li>
<li>INTERNATIONAL
</li>
<li>IT
</li>
<li>LEGAL
</li>
<li>MANFACTURING
</li>
<li>MARINE
</li>
<li>MEDIA
</li>
<li>OIL & GAS
</li>
<li>ONLINE
</li>
<li>OTHERS
</li>
<li>PHARMA
</li>
<li>RETAIL
</li>
<li>THEME PARK
</li>
</ul>
</div>
Probably this will work as i have given some special styles (css) to some 'li' however this will not provide 100% output as you want but still effective in such case..
.nav {
width: 970px;
margin: 50px auto;
border:0px solid;
display: table
}
.nav ul {
padding: 0;
margin: 0
}
.nav ul li {
list-style: none;
float: left;
border: 1px solid #06C;
font-family: Swis721 Cn BT;
font-weight: bold;
display: block;
min-width:5%;
width:auto;
text-align:center
}
.nav ul li a {
text-decoration: none;
color: #06C;
padding: 10px 20px 10px 12px;
display: block
}
.nav ul li a:hover {
color: #fff;
background: #06c
}
<div class="nav">
<ul>
<li>ALL
</li>
<li>AGENCY
</li>
<li>AUTOMOBILES
</li>
<li>BANKING
</li>
<li>CONSUMER DURABLE & FMCG
</li>
<li>CONSULTING
</li>
<li style="width:25%">EDUCATIONAL
</li>
<li>FINANCIAL SERVICES
</li>
<li>HOSPITALITY
</li>
<li>THEME PARK
</li>
<li>INTERNATIONAL
</li>
<li>IT
</li>
<li>LEGAL
</li>
<li>MANFACTURING
</li>
<li style="width:15%">MARINE
</li>
<li>MEDIA
</li>
<li>OIL & GAS
</li>
<li>ONLINE
</li>
<li>OTHERS
</li>
<li>PHARMA
</li>
<li>RETAIL
</li>
<li style="width:45%">INFRASTRUCTURE & REAL ESTATE
</li>
</ul>
</div>
Note : Keep in mind the output will be different in such case like change of fonts, or any navigation position change other than it is written now..
you can use this
.nav{
border:0px solid;
}
.nav ul li{
width:25%;/*according to your need you can increase or decrease*/
}
.nav ul {
padding: 0;
margin: 0
}
.nav {
width: 960px;
margin: 50px auto;
border: 1px solid #06c;
display: table;
padding: 0px 0px;
font-size: 100%;
}
.nav ul li {
list-style: none;
float: left;
border: 1px solid #06C;
font-family: sans-serif;
font-weight: bold;
min-width: 7.8%;
width: auto;
font-size: inherit;
text-align: center;
}
.nav ul li a {
text-decoration: none;
color: #06C;
adding: 10px 12px 10px 12px;
display: list-item;
WIDTH: AUTO;
min-width: 100%;
box-sizing: border-box;
}
.nav ul li a:hover {
color: #fff;
background: #06c
}
<div class="nav">
<ul>
<li>ALL
</li>
<li>AGENCY
</li>
<li>AUTOMOBILES
</li>
<li>BANKING
</li>
<li>CONSUMER DURABLE & FMCG
</li>
<li>CONSULTING
</li>
<li>EDUCATIONAL
</li>
<li>FINANCIAL SERVICES
</li>
<li>HOSPITALITY
</li>
<li>INFRASTRUCTURE & REAL ESTATE
</li>
<li>INTERNATIONAL
</li>
<li>IT
</li>
<li>LEGAL
</li>
<li>MANFACTURING
</li>
<li>MARINE
</li>
<li>MEDIA
</li>
<li>OIL & GAS
</li>
<li>ONLINE
</li>
<li>OTHERS
</li>
<li>PHARMA
</li>
<li>RETAIL
</li>
<li>THEME PARK
</li>
</ul>
</div>
Related
for some reason my menu bar (its fixed) is in 2 lines in chrome browser and normal in all other browsers. Any idea why or how to fix it? I tried to figure it out but i didnt fix it. Is it a problem with browser default block height or what? I need to make it work on chrome and on all other browsers too.
JsFiddle: https://jsfiddle.net/wkupr9L6/1/
HTML:
<script>
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 65) {
$("nav").css("opacity", "0.2");
}
else {
$("nav").css("opacity", "1");
}
});
</script>
</head>
<body>
<!--MENU BAR!-->
<nav class="navig">
<span class="nadpis"> RPO </span>
<ul class="nav">
<li class="prve">Dátumy
<ul>
<li>1-7/7/2016
<ul>
<li>1/7/2016</li>
<li>2/7/2016</li>
<li>3/7/2016</li>
<li>4/7/2016</li>
<li>5/7/2016</li>
<li>6/7/2016</li>
<li>7/7/2016</li>
</ul>
</li>
<li>8-14/7/2016
<ul>
<li>8/7/2016</li>
<li>9/7/2016</li>
<li>10/7/2016</li>
<li>11/7/2016</li>
<li>12/7/2016</li>
<li>13/7/2016</li>
<li>14/7/2016</li>
</ul>
</li>
<li>15-21/7/2016
<ul>
<li>15/7/2016</li>
<li>9/7/2016</li>
<li>10/7/2016</li>
<li>11/7/2016</li>
<li>12/7/2016</li>
<li>13/7/2016</li>
<li>14/7/2016</li>
</ul>
</li>
</ul>
</li>
<li class="druhe">☰
<ul>
<li> FLV
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> FLC
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> QUA
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> HFX
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> PDT
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul></li>
<li> RSH
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> BUR
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> SUHRN </li>
<li> INCI </li>
<li> JIRA </li>
<li> CHGT </li>
<li> TASK </li>
<li> VRS </li>
</div>
</ul>
</li>
</ul>
</nav>
CSS:
body, nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav {
display: inline-block;
position: fixed;
width: 100%;
text-align: center;
background-color: #111;
vertical-align: top;
top: -1px;
opacity: 1;
transition: 0.3s;
}
nav:hover {
opacity: 1!important;
background-color: #111;
transition: 0.3s;
}
.nav a {
display: block;
background: #111;
color: #fff;
text-decoration: none;
padding: 0.7em 1.7em;
text-transform: uppercase;
font-size: 85%;
letter-spacing: 3px;
position: relative;
}
.nav{
vertical-align: top;
display: inline-block;
}
.nav li {
position: relative;
}
.nav > li {
float: left;
margin-right: 1px;
}
.nav li:hover > a {
transition: 0.3s;
background-color:#3a3939;
color: #40d23b;
}
.nav ul {
position: absolute;
white-space: nowrap;
z-index: 1;
left: -99999em;
background-color: #000;
border: 2px solid #81D4FA;
border-top: none;
}
.nav > li:hover > ul {
left: auto;
min-width: 100%;
}
.nav > li li:hover > ul {
left: 100%;
top:-1px;
}
.nav > li:hover > a:first-child:nth-last-child(2):before {
border: 5px solid transparent;
}
.nav li li:hover > a:first-child:nth-last-child(2):before {
border: 5px solid transparent;
right: 10px;
}
.prve{
max-width:125px;
min-width: 90px;
border: 2px solid #81D4FA;
border-bottom: none;
border-top: none;
}
.druhe {
max-width: 14px;
min-width: 110px;
border-right: 2px solid #81D4FA;
}
span {
float:left;
margin-left: 3px;
}
span a{
text-decoration: none;
color:#2670CF;
background-color:#111;
font-family: 'Helvetica Neue', sans-serif;
font-size: 30px;
font-weight: bold;
}
Thanks for help
This doesn't seem like a browser issue. You have .nav set to display: inline-block; but nothing on the two inner <li> elements to force them onto the same line.
I added this:
.nav > li {
display: inline-block;
}
And it works for me in Chrome. See here:
https://jsfiddle.net/tobyl/wkupr9L6/6/
.
This is what i am trying to achieve
I want the separator to be extended to full height. that is, it should cover the entire nav bar's height.
Html markup is as follows.
.mynav li {
list-style: none;
display: inline;
border-left: 1px solid white;
padding: 10px;
}
<div class="mynav pull-right">
<ul>
<li>TRENDS
</li>
<li>PRODUCTS
</li>
<li>DESIGNERS
</li>
<li>MEMBERS
</li>
<li>SEARCH
</li>
<li>MY ACCOUNT
</li>
</ul>
</div>
Since OP has updated his question this would be the solution
.mynav ul {
border-top: 1px solid blue;
border-bottom: 1px solid blue;
}
.mynav li {
list-style: none;
display: inline
}
.mynav a {
padding: 10px;
display: inline-block;
font-size: 10px
}
.mynav li:not(:last-child) a {
box-shadow: 1px 0 red
}
<div class="mynav pull-right">
<ul>
<li>TRENDS
</li>
<li>PRODUCTS
</li>
<li>DESIGNERS
</li>
<li>MEMBERS
</li>
<li>SEARCH
</li>
<li>MY ACCOUNT
</li>
</ul>
</div>
you can use pseudo element
.mynav li {
list-style: none;
display: inline;
padding: 10px;
position:relative
}
.mynav li:not(:last-child):before{
content:'';
position: absolute;
right: 0;
top:0;
bottom: 0;
width: 1px;
background: red
}
<div class="mynav pull-right">
<ul>
<li>TRENDS
</li>
<li>PRODUCTS
</li>
<li>DESIGNERS
</li>
<li>MEMBERS
</li>
<li>SEARCH
</li>
<li>MY ACCOUNT
</li>
</ul>
</div>
Alternatively, you can use box-shadow
.mynav li {
list-style: none;
display: inline;
padding: 10px;
position:relative
}
.mynav li:not(:last-child){
box-shadow: 1px 0 red
}
<div class="mynav pull-right">
<ul>
<li>TRENDS
</li>
<li>PRODUCTS
</li>
<li>DESIGNERS
</li>
<li>MEMBERS
</li>
<li>SEARCH
</li>
<li>MY ACCOUNT
</li>
</ul>
</div>
Your css should be display: inline-block if you wish to add padding to the top/bottom of your <li> element.
Try to set the padding to the A tag instead of Li tag :
.mynav li {
list-style: none;
display: inline;
border-left: 1px solid white;
}
.mynav li a {
padding: 10px;
}
In your CSS add width:13%; or something which will fit your width.
Check the code here
I have learnt CSS online and I am new to web designing. Need some expert opinion here, I may have written something wrong or stupid. Please forgive that as I am a beginner.
Here are my CSS and HTML codes:
#menu {
float: left;
width: 1000px;
height: 30px;
background-color:#0066FF;
border-bottom: 1px solid #333;``
}
#menu ul {
float: left;
width: 1000px;
margin: 0;
padding: 7px 0 0 0;
list-style: none;
}
#menu ul li{
display:inline;
}
li ul {display: none;}
li:hover ul {display: block; position:relative;}
li:hover li a{background: #0066FF;}
#menu ul li a{
float: left;
padding: 0 20px;
font-size: 12px;
font-weight: bold;
text-align: center;
text-decoration: none;
color: #FFFFFF;
}
#menu li a:hover, #menu li .current{
color: #FFFF00;
}
#menu ul li:hover ul{
width: 150px;
white-space: nowrap
height: 10px;
text-align: center;
background:#0066FF;
}
<div id="menu">
<ul>
<li>Home</li>
<li>Quran
<ul>
<li>Translation</li>
<li>Tajweed</li>
<li>Tafseer</li>
<li>Qoutes</li>
</ul>
</li>
<li>Ahadees
<ul>
<li>Sahih Al-Bukhari</li>
<li>Sahih Muslim</li>
<li> Sunan Abu-Dawud</li>
<li>al-Tirmidhi</li>
<li>al-Nasa'i</li>
<li>Ibn Maja </li>
</ul></li>
<li>Wazaif
<ul>
<li>Allah's help</li>
<li>Rizzaq</li>
<li>Aulaad</li>
<li>Marriage</li>
</ul></li>
<li>Rights & Duties
<ul>
<li>As Parents</li>
<li>As Husband</li>
<li>As Wife</li>
<li>As Son</li>
<li>As Daughter</li>
</ul></li>
<li>Videos
<ul>
<li>Molana Tariq Jameel</li>
<li>Dr Zakir Naik</li>
<li>Dr Farhat Hashmi</li>
<li>Naat videos</li>
</ul></li>
<li>Quran & Science</li>
<li>Library
<ul>
<li>Masnoon Duain</li>
<li>Tib-e-Nabvi</li>
<li>Tafseer</li>
<li>Islamic comerace</li>
</ul></li>
<li>FAQs</li>
<li>Blogs</li>
<li>Contacts</li>
</ul>
</div>
It looks like the problem is that you haven't positioned the sub-menus properly.
Because the sub-menu have not been given position:absolute they remain in the documents flow and so disturb other elements when shown.
Adding position:absolute removes them from the flow and solves the problem.
In order to be positioned according to the parent li, that li needs to be a block (hence display:inline-block)(you could float the li too if that's your choice) and be given position:relative.
Here's a suggestion that should help you along the way.
#menu ul li {
display:inline-block;
position: relative;
}
li ul {
display: none;
position: absolute;
top:100%;
left:0;
}
li:hover ul {
display: block;
}
JSfiddle Demo
#menu {
float: left;
width: 1000px;
height: 30px;
background-color: #0066FF;
border-bottom: 1px solid #333;
``
}
#menu ul {
float: left;
width: 1000px;
margin: 0;
padding: 7px 0 0 0;
list-style: none;
}
#menu ul li {
display: inline-block;
position: relative;
}
li ul {
display: none;
position: absolute;
top: 100%;
left: 0;
}
li:hover ul {
display: block;
}
li:hover li a {
background: #0066FF;
}
#menu ul li a {
float: left;
padding: 0 20px;
font-size: 12px;
font-weight: bold;
text-align: center;
text-decoration: none;
color: #FFFFFF;
}
#menu li a:hover,
#menu li .current {
color: #FFFF00;
}
#menu ul li:hover ul {
width: 150px;
white-space: nowrap height: 10px;
text-align: center;
background: #0066FF;
}
<div id="menu">
<ul>
<li>Home
</li>
<li>Quran
<ul>
<li>Translation
</li>
<li>Tajweed
</li>
<li>Tafseer
</li>
<li>Qoutes
</li>
</ul>
</li>
<li>Ahadees
<ul>
<li>Sahih Al-Bukhari
</li>
<li>Sahih Muslim
</li>
<li> Sunan Abu-Dawud
</li>
<li>al-Tirmidhi
</li>
<li>al-Nasa'i
</li>
<li>Ibn Maja
</li>
</ul>
</li>
<li>Wazaif
<ul>
<li>Allah's help
</li>
<li>Rizzaq
</li>
<li>Aulaad
</li>
<li>Marriage
</li>
</ul>
</li>
<li>Rights & Duties
<ul>
<li>As Parents
</li>
<li>As Husband
</li>
<li>As Wife
</li>
<li>As Son
</li>
<li>As Daughter
</li>
</ul>
</li>
<li>Videos
<ul>
<li>Molana Tariq Jameel
</li>
<li>Dr Zakir Naik
</li>
<li>Dr Farhat Hashmi
</li>
<li>Naat videos
</li>
</ul>
</li>
<li>Quran & Science
</li>
<li>Library
<ul>
<li>Masnoon Duain
</li>
<li>Tib-e-Nabvi
</li>
<li>Tafseer
</li>
<li>Islamic comerace
</li>
</ul>
</li>
<li>FAQs
</li>
<li>Blogs
</li>
<li>Contacts
</li>
</ul>
</div>
I am somehow not been able to manage this menu to full width
this is my codepen
http://codepen.io/anon/pen/xwDcb
i want my dropdown menu width to be 100% from left to right. What am I doing wrong
body {
background-color:#000;
}
.toggleMenu {
display: none;
background: #666;
padding: 10px 15px;
color: #fff;
text-transform: uppercase;
font-weight: bold;
width:100%;
}
.nav-full {
background:url(../images/nav-bg.png) no-repeat 0 0;
}
.nav-centre {
width:960px;
margin:0 auto
}
.nav {
list-style: none;
*zoom: 1;
}
.nav:before, .nav:after {
content:" ";
display: table;
}
.nav:after {
clear: both
}
.nav ul {
list-style: none;
}
my html code
<a class="toggleMenu" href="#">Menu</a>
<div class="nav-full">
<div class="nav-centre">
<ul class="nav">
<li>HOME
<ul>
<li>Indus Advantage
</li>
<li>Positioning and flexibility of products
</li>
<li>Pipeline
</li>
</ul>
</li>
<li> Products
<ul>
<li>Overview
</li>
<li>Exercise Physiology
</li>
<li>Manufacturing & Quality Control
</li>
</ul>
</li>
<li> Patents & Publications
<ul>
<li>Global Patenting Strategy
</li>
<li>Publications
</li>
</ul>
</li>
<li> Partnering
<ul>
<li>Enquiries - Product
</li>
<li>Enquiries - Business Partnering
</li>
</ul>
</li>
<li> About Us
<ul>
<li>Vision & Values
</li>
<li>Conventional v/s the Indus Discovery Model
</li>
</ul>
</li>
<li> Contact Us
</li>
<li> Careers
</li>
</ul>
</div>
</div>
check with this code
<style>
#nav {
height: 1;
list-style-type: none;
padding-top: 1.25em;
margin-top: 0em;
}
#nav > li { /* Added ">" */
float: right;
position: relative;
padding: 0;
}
#nav li a {
display: inline-block; /* was block */
font-size: 14px;
padding: 0 1em;
margin-bottom: 1em;
color: #333;
text-decoration: none;
border-left: 1px solid #333;
}
#nav .last, #nav li ul li a {
border-left: none;
}
#nav li a:hover, #nav li a:focus {
color: #666;
}
#nav li ul {
opacity: 0;
/*position: absolute;
right: 0em; */
list-style-type: none;
padding: 0; margin: 0;
}
#nav li:hover ul {
opacity: 1;
}
#nav li ul li {
/*float: none;
position: static;
width: auto;*/
height: 0;
line-height: 0;
background: none;
text-align: left;
margin-bottom: .75em;
}
#nav li:hover ul li {
height: 25px;
line-height: 2.5em;
}</style>
<ul id="nav">
<a class="toggleMenu" href="#">Menu</a>
<div class="nav-full">
<div class="nav-centre">
<ul class="nav">
<li>HOME
<ul>
<li>Indus Advantage
</li>
<li>Positioning and flexibility of products
</li>
<li>Pipeline
</li>
</ul>
</li>
<li> Products
<ul>
<li>Overview
</li>
<li>Exercise Physiology
</li>
<li>Manufacturing & Quality Control
</li>
</ul>
</li>
<li> Patents & Publications
<ul>
<li>Global Patenting Strategy
</li>
<li>Publications
</li>
</ul>
</li>
<li> Partnering
<ul>
<li>Enquiries - Product
</li>
<li>Enquiries - Business Partnering
</li>
</ul>
</li>
<li> About Us
<ul>
<li>Vision & Values
</li>
<li>Conventional v/s the Indus Discovery Model
</li>
</ul>
</li>
<li> Contact Us
</li>
<li> Careers
</li>
</ul>
</ul>
</div>
</div>
you have to give the nav-center class 100%, now its at 975px or something like that, and it wrapps your list elements. so the 100% of the unordered list are relative to the nav-center element.
and if you want to get the nav menu centered giv the nav-centre class position:relative;
left: 50% and margin:left -511px. (margin-left should be have of the width of the unordered list)
i think the best solution would be that you put the dropdown menu out of the ul from the navi.
So its not relative to the other list.
markup your html like this:
<a class="toggleMenu" href="#">Menu</a>
<div class="nav-full">
<div class="nav-centre">
<ul class="nav">
<li>HOME</li>
<li> Products</li>
<li> Patents & Publications</li>
<li> Partnering</li>
<li> About Us</li>
<li> Contact Us</li>
<li> Careers </li>
</ul>
<ul>
<li class="under">Indus Advantage</li>
<li class="under">Positioning and flexibility of products</li>
<li class="under">Pipeline
</ul>
<ul>
<li class="under">Overview</li>
<li class="under">Exercise Physiology</li>
<li class="under">Manufacturing & Quality Control</li>
</ul>
<ul>
<li class="under">Global Patenting Strategy</li>
<li class="under">Publications</li>
</ul>
<ul>
<li class="under">Enquiries - Product</li>
<li class="under">Enquiries - Business Partnering</li>
</ul>
<ul>
<li class="under">Vision & Values</li>
<li class="under">Conventional v/s the Indus Discovery Model</li>
</ul>
</div>
</div>
you now just have to give li.under position:absolute and the rest, how to style, should be clear.
I am trying to get the gray buttons at the top of this page to all fit across the top (in line with the body), rather than on two lines: http://www.nbm.org/test/nbm-online-drafts/dropdown-testing.html
I have it set up as a list:
<nav id="main-nav">
<ul id="nav-primary">
<li><img src="http://www.nbm.org/assets/images/homepage/2011/nav-sprites/planyourvisit.jpg" alt="Plan Your Visit" width="109" height="48">
<ul class="subnav">
<li>Buy Tickets
</li>
<li>Hours & Admission
</li>
<li>Accessibility & Directions
</li>
<li>Tours
</li>
</ul>
</li>
<li><img src="http://www.nbm.org/assets/images/homepage/2011/nav-sprites/exhibitionscollections.jpg" alt="Exhibitions / Collections" width="109" height="48">
<ul class="subnav">
<li>Current Exhibitions
</li>
<li>Upcoming Exhibitions
</li>
<li>Buy Tickets
</li>
<li>Collections
</li>
</ul>
</li>
<li><img src=" http://www.nbm.org/assets/images/homepage/2011/nav-sprites/adultprogs.jpg" alt="Adult Programs" width="109" height="48">
<ul class="subnav">
<li>Upcoming Programs
</li>
<li>Spotlight on Design
</li>
<li>Watch / Listen
</li>
<li>Continuing Education Credits
</li>
</ul>
</li>
<li><img src="http://www.nbm.org/assets/images/homepage/2011/nav-sprites/familiesteens.jpg" alt="Families / Teens" width="109" height="48">
<ul class="subnav">
<li>Festivals
</li>
<li>Everyday Activities
</li>
<li>Teens & Young Adults
</li>
<li>Summer Camp
</li>
<li>Scouts & Youth Groups
</li>
<li>Birthday Parties
</li>
</ul>
</li>
<li><img src="http://www.nbm.org/assets/images/homepage/2011/nav-sprites/schoolseducators.jpg" alt="Schools / Educators" width="109" height="48">
<ul class="subnav">
<li>For Educators
</li>
<li>For Teens & Young Adults
</li>
<li>Plan a School Visit
</li>
</ul>
</li>
<li><img src="http://www.nbm.org/assets/images/homepage/2011/nav-sprites/joindonate.jpg" alt="Join / Donate" width="109" height="48">
<ul class="subnav">
<li>Donate Now
</li>
<li>Membership
</li>
<li>Corporate Giving
</li>
<li>Awards & Honors
</li>
<li>Volunteer
</li>
</ul>
</li>
<li><img src="http://www.nbm.org/assets/images/homepage/2011/nav-sprites/shop.jpg" alt="Shop" width="109" height="48">
<ul class="subnav">
<li>Books
</li>
<li>Home
</li>
<li>Toys
</li>
<li>Museum
</li>
<li>Stationery
</li>
<li>Fashion
</li>
<li>Design
</li>
</ul>
</li>
<li><img src="http://www.nbm.org/assets/images/homepage/2011/nav-sprites/aboutus.jpg" alt="About Us" width="109" height="48">
<ul class="subnav">
<li>About the Museum
</li>
<li>E-newsletters
</li>
<li>Press Room
</li>
<li>Staff & Governance
</li>
<li>Employment & Internships
</li>
</ul>
</li>
</ul>
I want to keep the li right margin at 4px, but that pushes the "About Us" button to a second line. Changing the li right margin to 3px is too little and the buttons do not line up with the body on the right.
CSS:
#main-nav {
background: none repeat scroll 0 0 white;
height: 53px;
left: 0;
position: relative;
top: 128px;
width: 100%;
z-index: 11;
}
#main-nav .subnav {
background: none repeat scroll 0 0 #D7D6D4;
border: 0 solid #D4D5D6;
display: none;
left: 0;
list-style-type: none;
margin: 0;
padding: 0;
position: absolute;
top: 49px;
width: 109px;
z-index: 11;
}
#main-nav .subnav li {
border-bottom: 1px solid #EEEEEE;
display: block;
margin: 0;
}
#main-nav .subnav li a {
color: #000000;
font-size: 11px;
height: 18px;
padding: 6px 4px 19px;
width: 101px;
}
#main-nav .subnav li a:hover {
background: none repeat scroll 0 0 #BFBEBA;
width: 101px;
}
#nav-primary {
float: left;
list-style-type: none;
margin: 0;
padding: 0;
}
#nav-primary li {
float: left;
margin-right: 4px;
position: relative;
}
#nav-primary li a {
color: #000000;
float: left;
font-size: 13px;
font-weight: bold;
height: 48px;
line-height: 16px;
text-align: center;
text-decoration: none;
width: 109px;
}
#nav-primary li a:hover {
text-decoration: none;
}
#nav-primary li:hover .subnav {
display: block;
}
Is it possible to remove the right margin on the last li element? Or to hide it?
Any ideas are much appreciated!
It is this simple:
#nav-primary > li:last-child
{
margin-right:0;
}