CSS text alignment with Mac browsers - css

I've created a CSS top bar menu that uses the | character as separators. It's rendering exactly as it should on any browser I try for Linux or Windows. But, on Mac, with any browser, the | characters drop down a line or so, and render below the menu bar.
CSS
#menu {
position:relative;
width:80%;
min-width:800px;
margin-left:auto;
margin-right:auto;
margin-top:1%;
text-align:center;
border-top:1px solid #666666;
border-bottom:1px solid #666666;
padding: 12px 12px;
height:1.6em;
font-family: 'Geometria-Medium';
}
#menu ul {
display:inline-block;
margin: 0;
margin-left:auto;
margin-right:auto;
text-align:left;
padding: 0px;
line-height: 1.2em;
}
#menu li {
list-style:none;
}
#menu>ul>li {
float: left;
margin-right: 1px;
position:relative;
}
#menu>ul>li ul {
position:absolute;
}
#menu>ul>li ul>li {
bottom:0px;
display:none;
width:15em;
float:left;
}
#menu>ul>li:hover ul>li {
display:block
}
#menu a {
display:block;
padding: 0px 5%;
text-decoration: none;
text-transform: uppercase;
color:#666666;
line-height:2em;
}
#menu a:hover {
text-decoration: none;
cursor:pointer;
}
#menu .active {
}
#sub {
background-color:#CC0000;
line-height:2em;
}
#sub a:hover {
background-color:#ff9999;
}
HTML
<div id="menu">
<ul class="nav">
<li class="navLi" style="vertical-align: top !important;">Home <span style="vertical-align: top !important;"> |</span></li>
<li class="navLi">About <span style="vertical-align: top !important;"> |</span></li>
<li class="navLi">Services <span style="vertical-align: top !important;"> |</span></li>
<li class="navLi">Portfolio <span style="vertical-align: top !important;"> |</span>
<ul id="sub">
<li>The Sparkle Project</li>
<li>Jam In Jubilee</li>
<li>Connect Now Network</li>
<li>Ovidiu Bistriceanu</li>
<li>The Devon Clifford Music Foundation</li>
</ul>
</li>
<li class="navLi">Testimonials <span style="vertical-align: top !important;"> |</span></li>
<li class="navLi">Blog <span style="vertical-align: top !important;"> |</span></li>
<li class="navLi">Contact</li>
</ul>
</div>
Any help would be greatly appreciated. Thanks

If it was me..
I'd put all my css in a css file, not inline. Then I'd use css for visual appearances, like below..
#menu>ul>li{
border-right: 1px solid #000;
padding-right:20px;
padding-left: 10px;
}
#menu>ul>li:last-child {
border-right:none;
padding: none;
}
...
<div id="menu">
<ul class="nav">
<li class="navLi">Home</li>
<li class="navLi">About</li>
<li class="navLi">Services</li>
<li class="navLi">Portfolio
Demo

Related

How do I keep nested children (li) inline for my footer navigation?

I have a simple question. I'm trying to display the elements for "about" "general" and "social-buttons" classes within a nested unordered list. I want these to appear horizontal and inline with each other. I want them to be side by side basically, not vertical. If you can help me figure out which selector I need to add the 'display:inline' block, that would be much useful.
<div class="footer-container">
<div id="footer_menu">
<div id="footer-copy">
<li class="about-blurb">
<h3>Viral DNA</h3>
<ul>
<li>
<p>Virael Marketing is the leading digital marketing blog for the social web. We are a one-stop hub to help you learn from your viral marketing campaigns, offer tips & tricks, and build the best digital marketing teams.</p>
</li>
</ul>
<li class="General">
<h3>General</h3>
<ul>
<li><a class="button" href="#">Media</a></li>
<li><a class="button" href="#">Resources</a></li>
<li><a class="button" href="#">Blog</a></li>
<li><a class="button" href="#">Store</a></li>
<li><a class="button" href="#">Contact</a></li>
</ul>
<li class="social-icons">
<h3>Follow Virael</h3>
<ul>
<li>
<!--social media buttons go here-->
</li>
</ul>
</ul>
</div>
</div>
The CSS:
.footer-container {
font-family: MyriadPro-Regular, 'Myriad Pro Regular', MyriadPro,'MyriadPro', Arial, sans-serif;
float: left;
text-align: left;
width: 828px;
text-transform: capitalize;
background-color: #4169E1;
color: #FFF;
position: relative;
bottom: 0;
left: 269px;
border-top: 10px solid #B0C4DE;
overflow: hidden;
z-index=-1000;
}
.footer-container h3 {
text-align:justify;
}
#footer_menu {
font-family: MyriadPro-Regular, 'Myriad Pro Regular', MyriadPro,'MyriadPro', Arial, sans-serif;
list-style-type:none;
z-index=-1000;
}
#footer_menu ul {
margin: 0px 30px;
padding: 10px 30px;
list-style-type:none;
text-decoration:none;
display:inline;
z-index=-1000;
}
#footer_menu ul li {
margin: 0 0;
padding: 5px 0;
z-index=-100;
display:block;
color: white;
clear:both;
}
#footer_menu .about-blurb ul li {
width: 200px;
height: auto;
text-align:justify;
}
Replace your css with mine. Live example here
#footer_menu ul {
/* margin: 0px 30px; */
padding: 10px 30px;
list-style-type: none;
text-decoration: none;
display: inline;
}
#footer_menu ul li {
margin: 0 0;
padding: 5px 0;
display: inline-block;
color: white;
clear: both;
}
Remove margins from the ul and add inline-block to li

CSS Links Float IE7 or less

Following CSS - works fine in IE8 or greate but not for IE7 or less:
#main_navi {
list-style:none;
text-align:left;
padding:0px;
margin:0px 0px 20px 0px;
float:left;
}
.dsn li {
display: none;
}
a.main_navi_0 ul {
float:left;
display:none;
}
a.main_navi_0:link, a.main_navi_0:visited {
color:blue;
font-size:16px;
font-weight:200;
font-family: 'Allerta', sans-serif;
height:65px;
padding:40px 10px 0 20px;
display:block;
float:left;
text-align:center;
}
a.main_navi_1:link, a.main_navi_1:visited {
font-size:16px;
font-weight:200;
font-family: 'Allerta', sans-serif;
height:65px;
padding:40px 10px 0 20px;
display:block;
float:left;
text-align:center;
color: #3c94e2;
}
a.main_navi_0:hover, a.main_navi_1:hover {
color:#000;
border-bottom:5px solid #3c94e2;
}
a.sub_navi_0:link, a.sub_navi_0:visited {
color:#696969;
font-size:13px;
font-weight:200;
font-family: 'Allerta', sans-serif;
height:25px;
padding:5px 10px 0 10px;
display:block;
float:left;
text-align:center;
z-index:999;
position:relative;
border-bottom:2px solid #dedad6;
}
a.sub_navi_1:link, a.sub_navi_1:visited {
color:#696969;
font-size:13px;
font-weight:200;
font-family: 'Allerta', sans-serif;
height:25px;
padding:5px 10px 0 10px;
display:block;
float:left;
text-align:center;
z-index:999;
position:relative;
border-bottom:2px solid #3c94e2;
}
a.sub_navi_0:hover, a.sub_navi_1:hover {
color:#000;
border-bottom:2px solid #3c94e2;
}
MY html-file:
<div id="nav">
<div id="logo">
<a target="_self" href="fileadmin/../home.html">
<img border="0" title="4fleet Group" alt="" src="fileadmin/../fileadmin/img/logo.jpg">
</a>
</div>
<div id="main_navi">
<ul>
<li class="dsn">
<a class="main_navi_0" href="xyz.html">Über uns</a>
<ul>
<li>
<a class="sub_navi_0" href="xyz/team.html">Team</a>
</li>
<li>
<a class="sub_navi_0" href="xyz/presse.html">Presse</a>
</li>
</ul>
</li>
*another li with class ="dsn" tree*
</ul>
</div>
My output in IE7 or less than IE7:
Link1
Link2
Link3
I want it that way:
Link1 Link2 Link3
How do I get it to work in IE7. I do have an extra CSS file for IE7. I just don't know the code in CSS.
inline-block; is not a valid value for float
I guess you meant display: inline-block;. This won't work in IE7 though.
What you probably want is float: left; but it's hard to say without seeing any HTML.

Twitter Bootstrap: Collapsing menu for higher resolution screen such as Large desktop

I am building my website using twitter bootstrap. I want to specifically target my website for smartphones and tablet device. The nav bar is perfectly getting collapse for smartphone and ipad(portrait mode) devices. I need the same collapsed navbar for higher resolution devices such as ipad landscape mode and large desktop.
In bootstrap-responsive.css file if I can max-width from 979px to higher resolution such as 1024px and 1200px it did work. Is this a correct approach?
Navbar snippet
<div class="navbar navbar-fixed-top navbar-absolute">
<div class="navbar-inner">
<div class="container" style="width: auto;">
<a class="btn btn-navbar custom-collapse-btn" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://www.test.com/" target="_blank"><img src="img/logo.png" border="0" /></a>
<div class="pull-right icon-custom-search"></div>
<div class="nav-collapse">
<ul class="nav">
<li>
<ul class="nav" id="nav-menu-left">
<li>LMenu1</li>
<li>LMenu2</li>
<li>LMenu3</li>
<li>LMenu4</li>
<li>LMenu5</li>
<li>LMenu6</li>
</ul>
</li>
<li>
<ul class="nav" id="nav-menu-right">
<li><img src="img/icon-newsletter.png" border="0" /> Rmenu1</li>
<li><img src="img/icon-register-login.png" border="0" /> Rmenu2</li>
<li><img src="img/icon-download-app.png" border="0" /> RMenu3</li>
</ul>
</li>
<div id="nav-copyright-text"><a href="#">This is test text/a></div>
</ul>
</div><!-- /.nav-collapse -->
</div>
</div><!
-- /navbar-inner -->
</div>
Navbar custom CSS
.navbar-inner {
background-color: #13417c !important;
background-image: none;
background-repeat: no-repeat;
filter: none;
padding:0 !important;
border: 1px solid #000000;
}
.navbar .btn-navbar {
padding:15px 10px;
margin-right:0;
}
.navbar .btn {
margin-top:0;
margin-left:0;
}
.navbar-inner .btn-navbar {
background: black;
}
.navbar .btn-navbar:hover {
background: black;
color:black;
}
.navbar .btn-navbar:focus, .navbar .btn-navbar:active {
background: black;
color:black;
}
#rotate {
-webkit-transform:rotate(90deg);
-moz-transform:rotate(90deg);
-o-transform:rotate(90deg);
/* filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1.5); */
-ms-transform:rotate(90deg);
}
.icon-custom-search {
color: #fffafe;
background: url('../img/search_bg.png') no-repeat;
height: 43px;
padding-left: 46px;
}
.custom-collapse-btn {
border-radius: 0 !important;
-webkit-border-radius:0 !important;
-moz-border-radius:0 !important;
}
.nav-collapse.collapse {
background-color: #000000;
}
.navbar .nav > li {
line-height: 16px;
}
.nav-collapse .nav > li > a:hover {
background-color:#000000;
}
.nav-collapse .nav > li > a {
text-shadow:none;
}
#nav-menu-left {
width:49%;
float:left;
border-right: 1px solid #808080;
margin-top: 20px;
}
#nav-menu-right {
width:50%;
float:left;
margin-top: 20px;
}
#nav-menu-left > li > a {
color: #ffffff;
}
#nav-menu-right > li > a {
color:#85b3e5;
font-weight: normal;
}
#nav-menu-right > li > a > img {
padding-right:10px;
}
#nav-copyright-text {
clear:both;
}
#nav-copyright-text a {
color: #666666;
font-weight: bold;
padding: 10px;
}
#nav-copyright-text {
text-align: center;
}
#nav-copyright-text a:hover{
text-align: center;
text-decoration: none;
}
editing core files is an bad idea. insisted make use of media queries and get your tasks done.
<link rel='stylesheet' media='screen and (min-width: 979px) and (max-width: 1024px)' href='css/medium.css' />
and get your task done more efficiently.

how to make sub menu appear when hover over link?

how do i make a sub menu dissapear and appear when i hover over a link?
this is my menu:
<div class="sideMenu2">
<ul>
<li><a href>retail</a>
<ul class="subsideMenu2">
<li>cabot circus</li>
<li>st. stephen's</li>
<li>silverburn</li>
<li>braehead</li>
</ul>
</li>
<li><a href>sports & leisure</a>
<ul class="subsideMenu2">
</ul>
</li>
</ul>
</div>
This is my current css:
.sideMenu2 ul li.on a
{
height:2em;
padding-top: 2px;
background:url(../images/point.png) no-repeat;
font-weight:bold;
}
.sideMenu2 ul
{
padding: 15px 0px 0px 0px;
list-style-type:none;
font-size:0.9em;
width:20em;
color:#fff;
margin-left:-10px;
}
.sideMenu2 ul a{
padding: 2px 20px 0px 0px;
color:#fff;
text-decoration:none;
float:left;
width:19.2em;
}
.sideMenu2 li a
{
height:2em;
padding-top: 1px;
padding-left:15px;
}
.sideMenu2 li a:hover{
background:url(../images/point.png) no-repeat;
cursor:pointer;
padding-left:-15px;
}
.subsideMenu2 {
display: none;
}
.sideMenu2 li:hover .subsideMenu2 {
display: block;
}
But won't work in old Internet Explorer, for them the only option is javascript.
see this example script of header menu dropdwon style
http://bit.ly/1abEJ9o

CSS ids, classes and layouts

[Currently at: http://www.jsfiddle.net/tqtFg Michael Durrant]
I'm very new to css and I'm trying to create a website with a logo and navigation panel side by side. If you visit the site initially the panel appears out of the 'topcontent', just below and to the right in fact, but if you clicked the logo to go to the same page the panel appears where i'd like it to be!
My Site : http://acews.x10.mx
it seems something is not being intialized when first opened, but I can't tell what. here's my html code;
<div id="topcontent">
<div id="top">
<a href="index.html">
<img src="logo.png">
</a>
<div id="navbar">
<ul id="menubar">
<li class="menuButton">Home</li>
<li class="menuButton"><a href="about.html" >About ACE</a></li>
<li class="menuButton"><a href="login.html" >Customer Login</a></li>
</ul>
</div>
</div>
Here's my css code;
body {
}
/*Content page divider*/
#topcontent {
/* margin: 50px auto; */
height: 170px;
margin-left:auto;
margin-right:auto;
background-image:url('backgroundcolor.png');
}
#top {
height: 170px;
width: 900px;
margin-left:auto;
margin-right:auto;
}
/* MenuBar */
#navbar {
margin-top:60px;
float:right;
}
ul#menubar {
/* margin:20px; */
list-style:none;
margin-left:auto;
margin-right:auto;
padding: 5px 10px 0 10px;
}
ul#menubar li {
display:inline;
font-family: calibri;
font-weight: bold;
margin-left:10px;
}
ul#menubar li a {
text-decoration:none;
text-align:center;
padding:5px 10px;
/* width:100px; */
color:#FFFFFF;
float:left;
font-size:26px;
}
.menuButton a:hover{
background-color:#618E00;
text-decoration: none;
-webkit-border-radius: 5px;
}
add id for link with logo:
<a href="index.html" id="logo">
<img src="logo.png">
</a>
and CSS
#logo {float:left;}
link with logo is like one single line, if you add float to it should be ok.

Resources