I've done designing for desktop screen but it doesn't work for mobile phone. I'm wondering whats the problem. Here is my coding.
HTML
<div id="nav">
<span id="nav-icon"> <img src="assets/images/icon/navigation.png" alt="nav-menu"> </span>
<ul>
<li> LINK </li>
<li> LINK </li>
<li> LINK </li>
<li> LINK </li>
<li> LINK </li>
</ul>
<div class="navimage">
<img src="facebook-icon.png" alt="facebook-icon" />
<img src="twitter-icon.png" alt="twitter-icon" />
</div>
</div>
style.css
#nav {
border-bottom:1px solid #FFF;
margin-bottom:20px;
padding:0;
text-align:center;
max-width:95%;
margin:0 auto;
}
#nav #nav-icon img {
display:none;
}
#nav li {
display:inline;
}
#nav a {
display:inline-block;
padding:15px;
font-family: 'alegreya_sansregular', sans-serif;
font-weight:bold;
font-size:15px;
margin:15px 0;
}
#nav a:hover {
color:#DEB887;
text-decoration:none;
}
.navimage img {
width:30px;
height:30px;
border-radius:50%;
-webkit-border-radius:50%;
-moz-border-radius:50%;
-ms-border-radius:50%;
-o-border-radius:50%;
}
.imgnav img {
margin-left:-25px;
}
.navimage {
float:right;
margin-top:-80px;
}
responsive.css
#media only screen and (min-width: 480px) and (max-width: 767px) {
#nav {text-align:left;}
#nav-icon img {display:inline-block;height:40px;}
#nav ul, #nav:active ul {display:none;position:absolute;padding: 20px;background:#fff;border: 3px solid #DEB887;left:35px;top:70px;width:20%;border-radius:0 0 3px 3px;z-index:9999;}
#nav:hover ul {display:block;}
.navimage {margin-top:-300px;}
#nav li {text-align:center;display:block;}
#nav ul li a {color:#000;padding:0;}
}
The problem is
1. The image (navigation menu) is not showing at all.
2. Facebook and twitter logo cannot be seen.
3. I hover my mouse somewhere within a site but navigation bar randomly showed up (There wasn't any picture of navigation menu)
Here is the JSFIDDLE..
All for mobile screen (min-width: 480px and max-width: 767px). Any ideas?
Related
I'm trying to center align my menu that goes onto 2 lines.
I'm using ul li. not sure if this is the best option. I've trued everything from posts posted on SO, but nothing doing :(
I would like it to go onto 2 lines and still be centered
Here is s screen shot of what it looks like:
CSS:
#media only screen and (min-width: 300px) and (max-width: 480px) {
.header-links-mobile {
display:inline-block;
width:80%;
position:absolute;
top:60px;
left:0%;
text-align:center;
}
.header-links-mobile ul {
width:90%;
margin:auto;
padding:0;
display: flex;
justify-content: center;
}
.header-links-mobile ul li {
color:#fff;
padding:5px 5px 0 5px;
display: inline;
text-align: center;
}
.header-links-mobile ul li a {
color:#fff;
}
.header-links-mobile ul li a:hover {
color:#fff;
}
}
HTML
<div class="header-links-mobile">
<ul>
<li>
Admin Panel
</li>
<li>
asheenk#cyphernet.co.za
</li>
<li>
Log out
</li>
<li class="ico-account-wrapper">
My account
</li>
<li>
<a href="/mass-supply-live/cart" class="ico-cart" id="topcartlink">
<span class="cart-label">Shopping cart</span>
<span class="cart-qty">(54 ITEM)</span>
</a>
</li>
</ul>
</div>
Please add the following style
.header-links-mobile, .header-links-mobile ul {
width :100%;
}
.header-links-mobile ul {
flex-wrap: wrap;
}
Check this fiddle
I have a site header created with floating divs using this structure:
nav {
height:inherit;
width:100%;
margin:0 auto;
position:relative;
z-index:10;
text-align: center;
}
#nav-wrap {
min-width: 100%;
width: auto !important;
width:100%;
white-space:nowrap;
}
nav ul#nav-left, #nav-right {
list-style-type:none;
display:inline-block;
margin:0;
padding:0;
width:auto;
height:100%;
}
nav img {
display:inline-block;
padding:0;
margin:0;
max-height:225px;
vertical-align:top;
}
nav ul li {
display:inline-block;
text-align:center;
font-family: 'Oswald',helvetica,arial,sans-serif;
font-size:1.8rem;
font-weight:400;
padding:0 30px;
margin-top:30px;
}
<nav>
<div id="nav-wrap">
<ul id="nav-left">
<li>Option1</li>
<li>Option2</li>
<li>Option3</li>
</ul>
<img src="assets/img/img.png" />
<ul id="nav-right">
<li>Option4</li>
<li>Option5</li>
<li>Option6
</li>
</ul>
</nav>
Updated
I've been playing with layout and the floats were making things tough. So, it's all displayed as inline-block without floats, but the center logo still isn't resizing and I can't figure out what I'm doing wrong. Take a look at the staged site linked below to see what I'm going for. The logo overlap is intentional.
Staged site
I appreciate any help or suggestions. I'd like to avoid using display:table if possible.
#media queries is the thing you needed.
#media (max-width: 700px) {
nav ul li {
font-size:1.3rem;
padding:0 10px;
}
}
#media (max-width: 1200px) {
nav ul li {
font-size:1.5rem;
padding:0 20px;
}
}
#media (min-width: 1201px) {
nav ul li {
font-size:1.8rem;
padding:0 30px;
}
}
#media (max-width: 400px) {
nav ul li {
/*For this you need to use mobile friendly menu **/
}
}
I have a navigation bar that floats the buttons on the left. I no want to add 4 social media icons but I want them to align on the right. However we i add the social media icon they are aligned on the right but not inline with the navigation bar, but just below it. adding top:-50px;doesnt help.
<body>
<div class="menu">
<ul>
<li>TL Custom Printing</li>
<li class="active">Home</li>
<li>Custom Printing</li>
<li>Products</li>
<li>Gallery</li>
<li>About</li>
<li>Contact Us</li>
<div class="clearFloat"></div>
</ul>
</div>
<div class="social">
<img src="images/twitter.png" />
<img src="images/fb.png" />
<img src="images/flickr.png" />
<img src="images/pinterest.png" />
</div>
</body>
The CSS:
/* Navigation Bar
----------------------------------------------- */
.menu{
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
width:100%;
}
.menu ul{
list-style:none;
background:#2d2d2d;
margin:0;
padding:0;
}
.menu li{
display:inline-block;
float:left;
}
.menu li:first-child{
margin-left:20px;
margin-right:20px;
display:block;
padding:10px;
text-decoration:none;
color:#ff4800;
font-weight:bold;
font-size:14px;
border-top:2px solid transparent;
}
.menu a{
display:block;
padding:10px;
text-decoration:none;
color:#bbbbbb;
border-top:2px solid transparent;
}
.menu a:hover,
.menu li.active a{
background:#3d3d3d;
color:#dddddd;
border-top:2px solid #ff4800;
}
.clearFloat{
clear:both;
}
/* Social Media Icons
----------------------------------------------- */
#social {
float:right;
}
JSFIDDLE
You are clearing your floats in the .menu div so .menu and .social will never sit on the same line. Here is one solution (of which there are many):
DEMO
<div class="menu_wrap"> <!-- ADD A WRAPPER -->
<div class="menu">
<ul>
<!-- REMOVE THE CLEARFIX FROM HERE -->
</ul>
</div>
<div class="social">
...
</div>
<div class="clearFloat"></div> <!-- ADD CLEARFIX HERE -->
</div>
CSS
.menu_wrap {
background: #000;
}
Also, #social { should be .social { (class not ID)
Do You need this
Explanation:
1. Set width 100% to your header/footer.
.header
{
background: #333;
width: 100%;
height: 10%;
overflow: hidden;
}
2. Set width to menu and social and float properties..
.social
{
float:right;
width: 100%;
height: 100%;
overflow: hidden;
width: 28%;
}
.social a img
{
margin-top: 10px;
}
There is no social id in your code.
I have made a few changes in your mark up.I had put the div social inside the parent and had corrected the #social to .social in your css.
WORKING CODE
I have been working all night - just to fix a submenu. Here is my CSS:
/*************First Menu Layer************/
#navigation {
width:820px;
background-color:#45AAFF;
height:22px;
border-bottom:1px solid #fff;
font-family:'Signika',sans-serif
}
#navigation ul {
margin:0;
padding:0
}
#navigation li {
height:22px;
float:left;
position:relative;
display:block
}
#navigation li a {
color:#fff;
line-height:22px;
font-size:14px;
text-decoration:none;
padding:5px 15px 6px;
border-right:1px solid #fff
}
#navigation li a:hover {
text-decoration:underline;
background-color:#06C
}
/*************Second Menu Layer************/
#navigation li ul {
display:none;
position:absolute
}
#navigation li:hover ul {
display:block;
text-decoration:none;
background-color:#45AAFF;
border-bottom:1px dotted #006AC3
}
#navigation li ul li a {
color:#fff;
line-height:22px;
font-size:14px;
text-decoration:none;
padding:5px 15px 6px;
border-style:none
}
#navigation li ul li a:hover {
text-decoration:none;
border-bottom:1px solid #006AC3
}
And this is my HTML:
<!DOCTYPE html>
<html>
<head>
<link href="submenu.css" rel="stylesheet" type="text/css">
<title></title>
</head>
<body>
<div id="navigation">
<ul>
<li>
News
<ul>
<li>
National
</li>
<li>
International
</li>
<li>
Sport
</li>
<li>
Hollybood
</li>
</ul>
</li>
<li>
Technology
<ul>
<li>
IT/Software
</li>
<li>
Hardware
</li>
<li>
Iphone
</li>
<li>
Neuro Science
</li>
</ul>
</li>
<li>
Sports
<ul>
<li>
Cricket
</li>
<li>
Tenis
</li>
<li>
Badminton
</li>
<li>
Hockey
</li>
</ul>
</li>
<li>
Country
<ul>
<li>
India
</li>
<li>
America
</li>
<li>
France
</li>
<li>
Pakistaan
</li>
</ul>
</li>
</ul>
</div>
</body>
</html>
1st problem: My Submenu block doesn't show properly. If the menu contain with more than one word, the next word go to the next line. How can I make it inline? Refer to this image: http://i.stack.imgur.com/9SqWf.jpg
2nd Problem: When I hover to the submenu, how can I make them standardized? Please refer to this image: http://i.stack.imgur.com/DULg6.jpg
One of it left empty space on the right - it suppose to show full blue background, following the longest menu.
Can somebody help me to explain and solve this issue? I just want to make them tidy.
There are some problems in the code.
1. You mentioned the element as position: absolute, but you didn't mention the perfect width for them.
2. Selector defining was the main problem in the code.
3. Padding Measurement
You can copy the whole css & Most Importantly Use Indentation Always
/*************First Menu Layer************/
#navigation {
width:820px;
background-color:#45AAFF;
height:22px;
border-bottom:1px solid #fff;
font-family:'Signika',sans-serif;
}
#navigation ul {
margin:0;
padding:0;
}
#navigation li {
height:22px;
float:left;
position:relative;
display:block;
}
#navigation>ul>li>a {
color:#fff;
line-height:22px;
font-size:14px;
text-decoration:none;
padding:5px 15px 6px;
border-right:1px solid #fff;
}
#navigation li a:hover {
text-decoration:underline;
}
/*************Second Menu Layer************/
#navigation li ul {
display:none;
position:absolute;
}
#navigation li:hover ul {
display:block;
text-decoration:none;
background-color:#45AAFF;
border-bottom:1px dotted #006AC3;
width: 250px;
}
#navigation li ul li{
position: relative;
min-width: 100%;
padding: 5px 0px 5px 0px;
}
#navigation li ul li a {
color:#fff;
line-height:22px;
font-size:14px;
text-decoration:none;
padding: 5px 0px 5px 0px;
border-style:none;
display: inline-block;
min-width: 100%;
}
#navigation li ul li a:hover {
text-decoration:none;
border-bottom:1px solid #006AC3;
background-color:#06C;
}
Hi there i had a nav bar which was working perfectly. Then i added a lightbox effect. Both work perfectly however in my css they are messing up. When i added some css to lightbox effects to the div it messes up my navigation bar. I think its something to do with the a tag. My code is below
Html:
<div id="nav">
<ul>
<li>Home</li>
<li>Regsiter</li>
<li>Rules</li>
<li>Photo's</li>
<li>Contact Us</li>
</ul>
</div>
<div class = "lightbox">
<img src="images/image1t.jpg" />
<img src="images/image2t.jpg" />
<img src="images/image3t.jpg" />
<img src="images/image4t.jpg" />
<img src="images/image5t.jpg" />
<img src="images/image6t.jpg" />
</div>
CSS:
#nav ul
{
list-style-type:none;
margin:0;
padding:0;
overflow:hidden;
}
#nav ul li
{
float:left;
}
#nav a:link,a:visited
{
display:block;
width:163.2px;
height: 35px;
font-weight:bold;
color:#FFFFFF;
background-color:#181818;
text-align:center;
text-decoration:none;
text-transform:uppercase;
line-height: 35px;
}
#nav ul li a:hover
{
background-color:#989898;
}
//Below is the lightbox CSS
a
{
border:3px solid #ccc;
display:block;
float:left;
margin:10px;
}
a img
{
margin:3px;
}
a:hover
{
border:3px solid #666;
}
img
{
display:block;
}
Like i said. If i delete the light box CSS the nav bar works fine. When i add it, the border on the nav bar and everything changes. I think it something to do with them both having the a tag but not sure. Thanks for the help.
Apply the lightbox CSS only to elements inside the lightbox:
.lightbox a{
border:3px solid #ccc;
display:block;
float:left;
margin:10px;
}
.lightbox a img{
margin:3px;
}
.lightbox a:hover{
border:3px solid #666;
}
.lightbox img{
display:block;
}
Demo: http://jsfiddle.net/42BjW/ (I don't have the lightbox JS, so obviously the lightbox itself is not working)
just add .lightbox in front of your later classes , the lightbox css