I've been working on a css menu and it works fine in every browser besides Internet Explorer.
The issue can bee seen below: The first <li> element is not properly aligned. In fact, it's pushed down.
#sub-navigation {
background: url("{T_THEME_PATH}/images/subnavigation.png") repeat-x;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
height: 25px;
line-height: 25px;
border-bottom: 1px solid #dfeaf1;
border-left: 1px solid #dfeaf1;
border-right: 1px solid #dfeaf1;
border-top: 3px solid #ffffff;
}
#second-navigation li {
border-right: 1px solid #cddfeb;
padding-right: 14px;
padding-left: 14px;
margin-left: 0px;
float: left;
display: block;
font-size: 11px;
font-weight: none;
font-color: #6b6b6b;
}
#second-navigation ul {
position: absolute;
display: none;
z-index: 999;
background: #4e4e4e;
border: none;
border-radius: 2px;
width: 80px;
color: #FFFFFF;
}
<div id="sub-navigation">
<ul id="second-navigation" class="leftside">
<li>
<center>Calendar</center>
</li>
<li>
HH Converter
</li>
<li>
Poker Bonuses
</li>
</div>
Anyone know how to fix this, so it works in Internet Explorer.
Unfortunately, I can't test the actual code for you at the moment. Test stations are being moved around. From experience and off the top of my head -- there are a few errors.
The code:
#sub-navigation {
background: url("{T_THEME_PATH}/images/subnavigation.png") repeat-x;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
height: 25px;
line-height: 25px;
border-bottom: 1px solid #dfeaf1;
border-left: 1px solid #dfeaf1;
border-right: 1px solid #dfeaf1;
border-top: 3px solid #ffffff;
}
#second-navigation ul {
position: absolute;
display: none;
z-index: 999;
background: #4e4e4e;
border: none;
border-radius: 2px;
width: 80px;
color: #FFFFFF;
list-style:none;
}
#second-navigation li {
border-right: 1px solid #cddfeb;
padding-right: 14px;
padding-left: 14px;
margin-left: 0px;
float: left;
display: inline-block;
font-size: 11px;
font-weight: none;
font-color: #6b6b6b;
list-style-type:none;
}
#second-navigation li a {
display:block;
}
#second-navigation .center {
text-align:center;
}
<div id="sub-navigation">
<ul id="second-navigation" class="leftside">
<li>
Calendar
</li>
<li>
HH Converter
</li>
<li>
Poker Bonuses
</li>
</ul>
</div>
The changes are:
Unless you have a reset somewhere (like YUI Reset) ul and li should
include a list-style: none; and list-style-type:none;
On Internet Explorer, float:left; should be accompanied by
display:inline-block; NOT display:block;
On most browsers, elements within a p and a tag, will work... IE
usually throws a hissy fit. Use CSS to declare a text-align center...
which you should be doing anyways.
Hopefully this will help!
On a side note, CSS wise... if you are wanting the links centered and what not -- get rid of all the padding & margin write ups... browsers consider padding & margins differently and could be causing the issue.
A simple:
a {
display:block;
line-height: 25px;
text-align:center;
}
Would do the trick.
Related
JavaScript
nav{
width: 100%;
height: 60px;
background: linear-gradient(to bottom, #fff, #bbb);
border-bottom: 1px solid #fff;
}
.wrapper{
max-width:1200px;
margin:0 auto;
}
li{
float:left;
width: 15%;
list-style: none;
margin-top: 5px;
}
a{
text-decoration: none;
box-sizing: border-box;
display: block;
padding: 10px 10px;
text-align: center;
color: #052537;
}
.nav01,
.nav03,
.nav05{
border-right: 1px solid #999999;
border-left: 1px solid #fff;
}
.nav02,
.nav04{
border-left: 1px solid #fff;
border-right: 1px solid #999999;
}
<nav>
<div class="wrapper">
<div class="nav-global">
<ul>
<li class="nav01">go1</li>
<li class="nav02">go2</li>
<li class="nav03">go3</li>
<li class="nav04">go4</li>
<li class="nav05">go5</li>
</ul>
</div>
</div>
</nav>
Nav bar
Hello, everyone, I have the problem to design the nav bar very first and the last border. I want to make borders like in the shared picture. I can't figure it out how to design nav01 first border and nav 05 last border because I want a combination of two borders as I did in nav02,nav03 and nav04. Please help me
One way is to use border and use different properties of border to get your desired result. You can experiment and be as creative as you can. Just for once, go through all the possibilities and what CSS is capable of. Then you can easily figure out which properties to combine to make your own prototype into code.
nav {
width: 100%;
background: #e4e4e4;
font-family: 'arial';
}
.navbar-ul a {
text-decoration: none;
list-style-type: none;
display: block;
float: left;
font-size: 20px;
width: 120px;
border: 1px solid #000;
text-align: center;
margin: 10px 0px;
border-left: none;
border-top: none;
border-bottom: none;
color: #1f1f1f;
}
ul a:last-child {
border-right: none;
}
li {
margin: 5px;
}
a:hover {
text-decoration: none !important;
}
li:hover {
margin: 5px;
background: #1f1f1f;
color: white;
text-decoration: none !important;
transition: all .2s;
border-radius: 4px;
}
.navbar-ul a:hover {
cursor: pointer;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<nav class="clearfix">
<ul class="navbar-ul">
<a>
<li>Home</li>
</a>
<a>
<li>Profile</li>
</a>
<a>
<li>Contact</li>
</a>
<a>
<li>Blogs</li>
</a>
</ul>
</nav>
I have a navigation bar with four links. I want to remove the extra space to the left of "Projects" and the the right of "Contact". It appears to be part of the unordered list, and not padding or margin.
Here is the fiddle http://jsfiddle.net/95g12kpe/
<nav class="navbar">
<div class="container">
<ul class="navbar-list">
<li>Projects</li>
<li>Schedule</li>
<li>FAQ</li>
<li>Contact</li>
</ul>
</div>
</nav>
.navbar {
/*position: fixed;*/
top: 0;
left: 0;
z-index: 9999;
padding: 0;
text-align: center;
}
.navbar ul {
list-style: none;
background-color: #fff;
border-bottom: 2px solid #000000;
border-left: 2px solid #000000;
border-right: 2px solid #000000;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
margin-left: -4px;
margin-right: -4px;
}
.navbar li {
position: relative;
display: inline;
margin-bottom: 0;
margin-left: -20px;
}
.navbar li:hover {
color: #000033;
}
.navbar a {
display: inline-block;
padding-right: 25px;
padding-left: 25px;
text-decoration: none;
line-height: 6.5rem;
color: #222;
font-size: 1.6rem;
font-weight: 600;
}
.navbar a:hover {
color: #006699;
background-color: #000033;
}
It is a block element, so it has width 100% by default, set it to display: inline-block; and it should be fine.
http://jsfiddle.net/95g12kpe/1/
Set a width attribute to your .navbar ul, and to keep it centered, set your horizontal margin attributes to auto, like this for example :
.navbar ul {
list-style: none;
background-color: #fff;
border-bottom: 2px solid #000000;
border-left: 2px solid #000000;
border-right: 2px solid #000000;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
margin-left: auto;
margin-right: auto;
width: 500px;
}
I have a top navigation bar that still has the white borders around. I would like to know how to remove them using css.
This is the css:
#nav {
width: 100%;
float: left;
margin: 0 0 3em 0;
padding: 0;
list-style: none;
background-color: #4c4c4c;
}
#nav li {
float: left;
}
#nav li a {
display: block;
padding: 8px 15px;
text-decoration: none;
font-weight: bold;
color: white;
border-right: 1px solid #ccc;
}
#nav li a:hover {
color: grey;
background-color: white;
}
This is the HTML:
<body>
<ul id="nav">
<li>About Us</li>
<li>Our Products</li>
<li>FAQs</li>
<li>Contact</li>
<li>Login</li>
</ul>
Thanks.
Not sure about the question. In #nav li a You are giving border-right: 1px solid #ccc; remove this and I can not see any border any more. Let me know in case you needed something else.
Change border-right: 1px solid #ccc; to border-right: 0px solid #ccc; .Hence,
#nav li a {
display: block;
padding: 8px 15px;
text-decoration: none;
font-weight: bold;
color: white;
border-right: 0px solid #ccc;
}
please check the below code and modify accordingly. The issue will be resolved.
#nav li a {
display: block;
padding: 8px 15px;
text-decoration: none;
font-weight: bold;
color: white;
}
I have a navigation menu and when i click on any menu its background as of home item does not remain selected i tried my best and also did googling but could not solve
my navigation menu is as
enter code here
<ul id="navigation">
<li id="selected" style="width: 90px">Home</li>
<li class="hov" style="width: 130px">Get Help</li>
<li class="hov" style="width: 90px">Pricing</li>
<li class="hov" style="width: 90px">Contact</li>
<li class="hov"><a class="hov" href="Disclaimer.aspx">Disclaimer</a></li>
</ul>
enter code here
and its CSS is as:
#navigation
{
list-style: none;
padding: 0px;
margin: 0px;
float: right;
width: 570px;
border: 0px solid red;
font-size: 16px;
margin-top: -30px;
}
#navigation li
{
float: left;
width: 150px;
height: 40px;
margin-left: 3px;
text-align: center;
border-radius: 5px;
padding-top: 0px;
border: 0px solid black;
position: relative;
border: 0px solid black;
display: block;
}
.hov a
{
color: black;
}
#navigation li a
{
border: 0px solid black;
height: 30px;
display: block;
text-align: center;
padding-top: 8px;
text-decoration: none;
border-radius: 5px;
}
#selected a
{
background-color: #097Abf;
color: White;
}
#selected a:hover
{
background-color: #216894;
color: White;
}
.hov a:hover
{
color: #097Abf;
background: url('supimages/field-bg.gif') repeat-x scroll 0px bottom #FFF;
}
I just changed one or two things to show you my approach, should be fairly simple for you to understand this as you got this far.
I added a class of .active (your old selected)
#navigation a.active
{
background-color: #097Abf;
color: White;
}
And I added the following Jquery to add and remove that class from the link when you click on it.
$("#navigation a").click(function(){
$("#navigation a.active").removeClass("active");
$(this).addClass("active");
});
HERE IS A FIDDLE
My navigation bar currently is scrunching all my text together. I have "headers" for the dropdown list, and the headers aren't forcing a line.
The HTML looks like this:
<li><p>Services</p><ul>
<li id="ITServices"><p>IT Services</p></li>
<li>Portals, Collaboration & Workflows</li>
<li>Business Intelligence & Dashboards</li>
<li>Mobile Development</li>
<li>Custom Application Development</li>
<li id="healthcare"><p>Healthcare Services</p></li>
<li>EMR, ICD 10 and Healthcare Consulting</li>
</ul></li>
CSS looks like this:
#healthcare p {
width: 280px;
margin-left: 0px;
padding: 0px;
display: inline;
}
#ITServices p {
width: 280px;
margin-left: 0px;
padding: 0px;
display: inline;
}
.navbar li:hover ul {
left: 15px;
top: 40px;
background: #7FBA00;
padding: 1px;
width: 280px;
border: none;
text-align: left;
}
.navbar li:hover ul a {
margin: -7px -10px -7px -15px;
text-align: left;
padding: 0px 0px 0px 10px;
display: block;
font-size: 11px;
width: 259px;
line-height: 25px;
color: #000;
background-color: #F0F0F0;
text-decoration: none;
border-left: 10px solid #7FBA00;
border-bottom: 1px solid transparent;
border-right: 1px solid transparent;
border-top: 1px solid transparent;
}
.navbar li:hover ul a:hover {
background: #7FBA00;
border-left: solid 10px #fff;
border-top: solid 1px #fff;
border-bottom: solid 1px #fff;
width: 260px;
}
Ahhh! Right? I'm trying to get it to all display in a list with basically line breaks after each li element. Help?
Basically a rule is over-riding your style. display property called block makes an element to behave like a block element, thus covering full line.
Your use might be the following, so try this
li > ul li { display: block; }