Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-14-2013, 06:34 PM   PM User | #1
alank2
New Coder

 
Join Date: Jun 2012
Posts: 25
Thanks: 4
Thanked 0 Times in 0 Posts
alank2 is an unknown quantity at this point
CSS menu help...

Hi everyone,

I am using a free css menu, but I can't get some small icons to show up at the right of the menu. For some reason the icons want to show up vertically.

The wp.png is in the menu line, but the tw.png and fb.png appear vertically below it instead of to the right of it. I also want these icons to be right justified to the right edge of the menu line.

I've tried a ton of things - any ideas?

Thanks,

Alan


HTML:
Code:
<link rel="stylesheet" type="text/css" href="menu.css">

<div id='cssmenu'>
<ul>
   <li><a href='index.shtml'><span>Home</span></a></li>
   <li class='has-sub'><a href='#'><span>Solutions</span></a>
      <ul>
         <li><a href='demo.shtml'><span>Demo</span></a></li>
         <li><a href='demo.shtml'><span>Demo</span></a></li>
         <li><a href='demo.shtml'><span>Demo</span></a></li>
         <li class='last'><a href='demo.shtml'><span>Demo</span></a></li>
      </ul>
   </li>
   <li><a href='service.shtml'><span>Service</span></a></li>
   <li class='last'><a href='contact.shtml'><span>Contact</span></a></li>
</ul>

   <div><a href=""><img src="images/wp.png" width="45" height="45" border="0"></a></div>
   <div><a href=""><img src="images/tw.png" width="48" height="48" border="0"></a></div>
   <div><a href=""><img src="images/fb.png" width="48" height="48" border="0"></a></div>

</div>
CSS:
Code:
#cssmenu img
  {
    float: left;
    display: inline;
    padding: 0px;
    padding-top: 4px;
  }


#cssmenu ul,
#cssmenu li,
#cssmenu span,
#cssmenu a 
{
  margin: 0;
  padding: 0;
  position: relative;
}

#cssmenu 
{
  height: 55px;
  background: #141414;
  background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALElEQVQImWMwMrJi

+v//PxMDw3+m//8ZoPR/qBgDEhuXGLoeYswhXg8R5gAAdVpfoJ3dB5oAAAAASUVORK5CYII=) 100% 100%; 
  background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
  background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
  background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
  border-bottom: 2px solid #0fa1e0;
}

#cssmenu:after,
#cssmenu ul:after 
{
  content: '';
  display: block;
  clear: both;
}

#cssmenu a 
{
  background: #141414;
  background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALElEQVQImWMwMrJi

+v//PxMDw3+m//8ZoPR/qBgDEhuXGLoeYswhXg8R5gAAdVpfoJ3dB5oAAAAASUVORK5CYII=) 100% 100%; 
  background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
  background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
  background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
  color: #ffffff;
  display: inline-block;
  font-family: Helvetica, Arial, Verdana, sans-serif;
  font-size: 12px;
  line-height: 55px;
  padding: 0 20px;
  text-decoration: none;
}

#cssmenu ul 
{
  list-style: none;
}

#cssmenu > ul 
{
  float: left;
}

#cssmenu > ul > li 
{
  float: left;
}

#cssmenu > ul > li:hover:after 
{
  content: '';
  display: block;
  width: 0;
  height: 0;
  position: absolute;
  left: 50%;
  bottom: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid #0fa1e0;
  margin-left: -10px;
}

#cssmenu > ul > li.active > a 
{
  box-shadow: inset 0 0 3px #000000;
  -moz-box-shadow: inset 0 0 3px #000000;
  -webkit-box-shadow: inset 0 0 3px #000000;
  background: #070707;
  background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALklEQVQImWNQU9Nh

+v//PxMDw3+m//8ZkNj/mRgYIHxy5f//Z0BSi18e2TwS5QG4MGB54HL+mAAAAABJRU5ErkJggg==) 100% 100%; 
  background: -moz-linear-gradient(top, #26262c 0%, #070707 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #070707));
  background: -webkit-linear-gradient(top, #26262c 0%, #070707 100%);
  background: -o-linear-gradient(top, #26262c 0%, #070707 100%);
  background: -ms-linear-gradient(top, #26262c 0%, #070707 100%);
  background: linear-gradient(to bottom, #26262c 0%, #070707 100%);
}

#cssmenu > ul > li:hover > a 
{
  background: #070707;
  background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALklEQVQImWNQU9Nh

+v//PxMDw3+m//8ZkNj/mRgYIHxy5f//Z0BSi18e2TwS5QG4MGB54HL+mAAAAABJRU5ErkJggg==) 100% 100%; 
  background: -moz-linear-gradient(top, #26262c 0%, #070707 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #070707));
  background: -webkit-linear-gradient(top, #26262c 0%, #070707 100%);
  background: -o-linear-gradient(top, #26262c 0%, #070707 100%);
  background: -ms-linear-gradient(top, #26262c 0%, #070707 100%);
  background: linear-gradient(to bottom, #26262c 0%, #070707 100%);
  box-shadow: inset 0 0 3px #000000;
  -moz-box-shadow: inset 0 0 3px #000000;
  -webkit-box-shadow: inset 0 0 3px #000000;
}

#cssmenu .has-sub 
{
  z-index: 1;
}

#cssmenu .has-sub:hover > ul 
{
  display: block;
}

#cssmenu .has-sub ul 
{
  display: none;
  position: absolute;
  width: 200px;
  top: 100%;
  left: 0;
}

#cssmenu .has-sub ul li 
{
  *margin-bottom: -1px;
}

#cssmenu .has-sub ul li a 
{
  background: #0fa1e0;
  border-bottom: 1px dotted #6fc7ec;
  filter: none;
  font-size: 11px;
  display: block;
  line-height: 120%;
  padding: 10px;
}

#cssmenu .has-sub ul li:hover a 
{
  background: #0c7fb0;
}

#cssmenu .has-sub .has-sub:hover > ul 
{
  display: block;
}

#cssmenu .has-sub .has-sub ul 
{
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
}

#cssmenu .has-sub .has-sub ul li a 
{
  background: #0c7fb0;
  border-bottom: 1px dotted #6db2d0;
}

#cssmenu .has-sub .has-sub ul li a:hover 
{
  background: #095c80;
}
alank2 is offline   Reply With Quote
Old 02-14-2013, 08:29 PM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello alank2,
Just floating the right thing will make quite a difference, look at it this way -
Code:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style type="text/css">
#cssmenu img {
	float: left;
	display: inline;
	padding: 0px;
	padding-top: 4px;
}
#cssmenu ul, #cssmenu li, #cssmenu span, #cssmenu a {
	margin: 0;
	padding: 0;
	position: relative;
}
#cssmenu {
	height: 55px;
	background: #141414;
 background:url(data:image/png;
base64, iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALElEQVQImWMwMrJi  +v//PxMDw3+m//8ZoPR/qBgDEhuXGLoeYswhXg8R5gAAdVpfoJ3dB5oAAAAASUVORK5CYII=) 100% 100%;
	background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
	background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
	background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
	background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
	background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
	border-bottom: 2px solid #0fa1e0;
}
#cssmenu:after, #cssmenu ul:after {
	content: '';
	display: block;
	clear: both;
}
#cssmenu a {
	background: #141414;
 background:url(data:image/png;
base64, iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALElEQVQImWMwMrJi  +v//PxMDw3+m//8ZoPR/qBgDEhuXGLoeYswhXg8R5gAAdVpfoJ3dB5oAAAAASUVORK5CYII=) 100% 100%;
	background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
	background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
	background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
	background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
	background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
	color: #ffffff;
	display: inline-block;
	font-family: Helvetica, Arial, Verdana, sans-serif;
	font-size: 12px;
	line-height: 55px;
	padding: 0 20px;
	text-decoration: none;
}
#cssmenu ul { list-style: none; }
#cssmenu > ul { float: left; }
#cssmenu > ul > li { float: left; }
#cssmenu > ul > li:hover:after {
	content: '';
	display: block;
	width: 0;
	height: 0;
	position: absolute;
	left: 50%;
	bottom: 0;
	border-left: 10px solid transparent;
	border-right: 10px solid transparent;
	border-bottom: 10px solid #0fa1e0;
	margin-left: -10px;
}
#cssmenu > ul > li.active > a {
	box-shadow: inset 0 0 3px #000000;
	-moz-box-shadow: inset 0 0 3px #000000;
	-webkit-box-shadow: inset 0 0 3px #000000;
	background: #070707;
 background:url(data:image/png;
base64, iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALklEQVQImWNQU9Nh  +v//PxMDw3+m//8ZkNj/mRgYIHxy5f//Z0BSi18e2TwS5QG4MGB54HL+mAAAAABJRU5ErkJggg==) 100% 100%;
	background: -moz-linear-gradient(top, #26262c 0%, #070707 100%);
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #070707));
	background: -webkit-linear-gradient(top, #26262c 0%, #070707 100%);
	background: -o-linear-gradient(top, #26262c 0%, #070707 100%);
	background: -ms-linear-gradient(top, #26262c 0%, #070707 100%);
	background: linear-gradient(to bottom, #26262c 0%, #070707 100%);
}
#cssmenu > ul > li:hover > a {
	background: #070707;
 background:url(data:image/png;
base64, iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALklEQVQImWNQU9Nh  +v//PxMDw3+m//8ZkNj/mRgYIHxy5f//Z0BSi18e2TwS5QG4MGB54HL+mAAAAABJRU5ErkJggg==) 100% 100%;
	background: -moz-linear-gradient(top, #26262c 0%, #070707 100%);
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #070707));
	background: -webkit-linear-gradient(top, #26262c 0%, #070707 100%);
	background: -o-linear-gradient(top, #26262c 0%, #070707 100%);
	background: -ms-linear-gradient(top, #26262c 0%, #070707 100%);
	background: linear-gradient(to bottom, #26262c 0%, #070707 100%);
	box-shadow: inset 0 0 3px #000000;
	-moz-box-shadow: inset 0 0 3px #000000;
	-webkit-box-shadow: inset 0 0 3px #000000;
}
#cssmenu .has-sub { z-index: 1; }
#cssmenu .has-sub:hover > ul { display: block; }
#cssmenu .has-sub ul {
	display: none;
	position: absolute;
	width: 200px;
	top: 100%;
	left: 0;
}
#cssmenu .has-sub ul li {  *margin-bottom: -1px;
}
#cssmenu .has-sub ul li a {
	background: #0fa1e0;
	border-bottom: 1px dotted #6fc7ec;
	filter: none;
	font-size: 11px;
	display: block;
	line-height: 120%;
	padding: 10px;
}
#cssmenu .has-sub ul li:hover a { background: #0c7fb0; }
#cssmenu .has-sub .has-sub:hover > ul { display: block; }
#cssmenu .has-sub .has-sub ul {
	display: none;
	position: absolute;
	left: 100%;
	top: 0;
}
#cssmenu .has-sub .has-sub ul li a {
	background: #0c7fb0;
	border-bottom: 1px dotted #6db2d0;
}
#cssmenu .has-sub .has-sub ul li a:hover { background: #095c80; }
.socials {float: left;}
.socials img {/*demo only since I don't have your images*/
  display: block; 
  background: #f00;
}
</style>
</head>
<body>
    <div id='cssmenu'>
        <ul>
           <li><a href='index.shtml'><span>Home</span></a></li>
           <li class='has-sub'><a href='#'><span>Solutions</span></a>
              <ul>
                 <li><a href='demo.shtml'><span>Demo</span></a></li>
                 <li><a href='demo.shtml'><span>Demo</span></a></li>
                 <li><a href='demo.shtml'><span>Demo</span></a></li>
                 <li class='last'><a href='demo.shtml'><span>Demo</span></a></li>
              </ul>
           </li>
           <li><a href='service.shtml'><span>Service</span></a></li>
           <li class='last'><a href='contact.shtml'><span>Contact</span></a></li>
        </ul>
       <a href="" class="socials"><img src="images/wp.png" width="45" height="45" border="0"></a>
       <a href="" class="socials"><img src="images/tw.png" width="48" height="48" border="0"></a>
       <a href="" class="socials"><img src="images/fb.png" width="48" height="48" border="0"></a>
    </div>
</body>
</html>
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

Last edited by Excavator; 02-14-2013 at 10:32 PM..
Excavator is offline   Reply With Quote
Old 02-15-2013, 05:23 AM   PM User | #3
Lisbon
New to the CF scene

 
Join Date: Sep 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Lisbon is an unknown quantity at this point
Post

Hello friends,

nice post for sharing with us.
Lisbon is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:05 AM.


Advertisement
Log in to turn off these ads.