Image Sprite Hover - css

Trying to get the following sprite to work http://reversl.net/sprites/ on hover. Here's my styling
#social {margin: 0; padding: 0; width: 212px; height: 48px; background-image: url('images/social-icons.png');}
#social li {margin: 0; padding: 0; list-style-type: none; display: inline; height: 48px; text-align: center; float: left;}
#social a {display: block; height: 48px;}
#social a:hover {background-image: url('images/social-icons.png');}
#social-home {width: 48px;}
#social-home a:hover {background-position: bottom 0;}
#social span {display: none;}
I think the problem is the background position of my hover declaration?

http://jsfiddle.net/aFL8A/2/
This seems like a thing you want to achieve, yes?

HTML :
<ul id="social">
<li id="social-facebook"><span>Facebook</span></li>
<li id="social-twitter"><span>Twitter</span></li>
<li id="social-googlePlus"><span>Google+</span></li>
<li id="social-youtube" class="last"><span>Youtube</span></li>
</ul>
CSS :
#social {margin: 0; padding: 0; width: 212px; height: 48px;}
#social li {
margin: 0 5px 0 0;
padding: 0;
list-style-type: none;
display: inline;
height: 48px;
float: left;}
#social li.last{
margin-right:0px;
}
#social li a {
background-image: url("images/social-icons.png") left top;
background-repeat : no-repeat;
display: block;
height: 48px;
width: 48px;
}
#social li#social-facebook a{
background-position: left top;
}
#social li#social-facebook a:hover{
background-position: left -53px;
}
#social li#social-twitter a{
background-position: -53px top;
}
#social li#social-twitter a:hover {
background-position: -53px -53px;
}
#social li#social-googlePlus a{
background-position: -106px top;
}
#social li#social-googlePlus a:hover {
background-position: -106px -53px;
}
#social li#social-youtube a{
background-position: -159px top;
}
#social li#social-youtube a:hover {
background-position: -159px -53px;
}
#social span {display: none;}

Related

How doing dropdown menu in Wordpress?

How me doing dropdown menu for pages and child pages on wordpress 4.0, but wp_page_menu not working, wp_list_pages('title_li=') ?> show menu but not show child pages. please help?
Try this:
ul.menu { list-style: none outside none; padding: 0; margin: 0 10px; float: left; font-size: 13px;}
ul.menu li { float: left; margin: 0; padding: 0 15px 0 0; position: relative; }
ul.menu li a { padding: 9px 5px; color: rgb(255, 255, 255); display: block; text-decoration: none; float: left; display: block;}
ul.menu li:hover { background: #A6CB1B; }
.current-cat { background: #8BBF47; }
ul.menu li span { width: 11px; height: 10px; float: left; background: url('/*url of your background or write color anme*/') -561px -78px no-repeat; margin: 11px 0 0 0;}
ul.menu li ul.children {z-index:99; list-style: none outside none; position: absolute; left: 0; top: 31px; background: none repeat scroll 0% 0% rgb(51, 51, 51); margin: 0; padding: 0; display: none; float: left; width: 170px; border-bottom: 1px solid #F8C92D;}
ul.menu li ul.children li { margin: 0; padding: 0; clear: both; width: 170px; border-top: 1px solid #F8C92D;}
html ul.menu li ul.children li a { float: left; width: 145px; background: url('images/narga-sprites.png') -578px -162px no-repeat #A6CB1B; padding-left: 20px; }
html ul.menu li ul.children li a:hover { background: url('/*url of your background or write color anme same as above*/') -578px -162px no-repeat #7BAF36; }
NOTE: This code is untested.Make sure to do necessary changes as per your needs.

Submenu won't go horizontal

I know others have asked this question, but I just cannot get my submenu to go horizontal.
Here's my html:
<div id="main">
<header>
<h1 id="hheading">Australian Design Architects</h1>
<img src="logo2.gif" alt="ADA LOGO" width="100" height="100" id="himg" />
<nav>
<ul id="MenuBar1" class="MenuBarHorizontal">
<li><code> <!--id="home"-->Home</code></li>
<li><code>About Us</code></li>
<li><code>Portfolio
<ul>
<li>Commercial</li>
<li>Residential</li>
<li>Heritage</li>
<li>Renovations/Additions</li>
</ul>
</code></li>
<li><code>Services</code></li>
<li><code>Contact us</code></li>
</ul>
</nav>
</header>
and here's my css:
nav {
font-size: 18px;
position: absolute;
padding-top: 50px;
padding-left: 140px;
padding-bottom:50px;
zoverflow:visible;
}
nav ul{
list-style: none;
float: left;
margin:0;
padding:0;
zclear: both;
}
nav ul li{
float:left;
display:inline;
}
nav ul li:after{
content:'|';
}
nav li a {
font-family:'flux_architect_regular', sans-serif;
text-decoration:none;
text-shadow: 1px 1px #333;
}
nav ul ul li a{
border:1px solid #000;
position:absolute;
display: inline-block;
overflow:hidden;
zwidth:550px;
zleft:0;
zlist-style:none;
zfloat: left;
zclear: both;
zmargin-left:-200px;
zpadding:100px;
}
and here's the css from dreamweaver:
ul.MenuBarHorizontal
{
margin: 0;
padding: 0;
list-style-type: none;
font-size: 100%;
cursor: default;
width: auto;
}
ul.MenuBarActive
{
z-index: 1000;
}
ul.MenuBarHorizontal li
{
margin: 0;
padding: 0;
list-style-type: none;
font-size: 100%;
position: relative;
text-align: center;
cursor: pointer;
width: 9.2em;
float: left;
}
#MenuBar1 li code #home {
text-align: center;
}
ul.MenuBarHorizontal ul
{
margin: 0;
padding: 0;
list-style-type: none;
font-size: 100%;
z-index: 1020;
cursor: default;
width: 8.2em;
position: absolute;
left: -1000em;
}
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
{
left: auto;
}
ul.MenuBarHorizontal ul li
{
width: 8.2em;
}
ul.MenuBarHorizontal ul ul
{
position: absolute;
margin: -5% 0 0 95%;
}
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
{
left: auto;
top: 0;
}
ul.MenuBarHorizontal a
{
cursor: pointer;
padding: 0.5em 0.75em;
color: #333;
text-decoration: none;
}
ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
{
background-color: #6a8c3f;
color: #FFF;
}
ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible
{
background-color: #6a8c3f;
color: #FFF;
}
ul.MenuBarHorizontal a.MenuBarItemSubmenu
{
background-image: url(SpryMenuBarDown.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}
ul.MenuBarHorizontal ul a.MenuBarItemSubmenu
{
background-image: url(SpryMenuBarRight.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}
ul.MenuBarHorizontal a.MenuBarItemSubmenuHover
{
background-image: url(SpryMenuBarDownHover.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}
ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover
{
background-image: url(SpryMenuBarRightHover.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
}
ul.MenuBarHorizontal iframe
{
position: absolute;
z-index: 1010;
filter:alpha(opacity:0.1);
}
#media screen, projection
{
ul.MenuBarHorizontal li.MenuBarItemIE
{
display: inline;
f\loat: left;
background: #FFF;
}
}
I need this for my course assignment, so please help.
hey i have created fiddle for you please check this link
http://jsfiddle.net/cooolkiran/zL2xR/
nav {
font-size: 18px;
position: absolute;
padding-top: 50px;
padding-left: 140px;
padding-bottom:50px;
zoverflow:visible;
}
nav ul {
list-style: none;
float: left;
margin:0;
padding:0;
zclear: both;
}
nav ul li {
float:left;
display:inline;
}
nav ul li:after {
content:'|';
}
nav ul li:last-child:after {
content:'';
}
nav li a {
font-family:'flux_architect_regular', sans-serif;
text-decoration:none;
text-shadow: 1px 1px #333;
padding:5px;
}
nav ul ul {
display:none;
}
nav ul li:hover ul {
display:block;
position:absolute;
width:auto;
left: 56px;
}
nav ul li li {
display:inline-block;
}
nav ul ul li a {
border:1px solid #000;
display: inline-block;
}

Sprites not displaying

Sprite rollover images not displaying.
The goal is to have a row of icons with a rollover controlled by CSS.
Currently, the code below does not display any images...what am I missing?
CSS:
#social {
margin: 0;
padding: 0;
height: 15px;
}
#social li {
margin: 0 5px 0 0;
padding: 0;
list-style-type: none;
display: inline;
height: 15px;
float: left;
}
#social li.last{
margin-right:0px;
}
#social li a {
background-image: url("../images/icon_twitter.png") 0px 0px;
background-repeat: no-repeat;
display: block;
height: 15px;
width: 18px;
}
#social li#social-twitter a{
background-position: 0px 0px;
}
#social li#social-twitter a:hover {
background-position: 0px -15px;
}
#social li#social-youtube a{
background-position: -18 top;
}
#social li#social-youtube a:hover {
background-position: -18 -15px;
}
#social span {
display: none;
}
HTML:
<ul id="social">
<li id="social-twitter"><span>Twitter</span></li>
<li id="social-youtube" class="last"><span>Youtube</span></li>
</ul>
You are trying to set the background position within background-image.
Change this:
background-image: url("../images/icon_twitter.png") 0px 0px;
To this:
background-image: url("../images/icon_twitter.png");
background-position: 0px 0px;
Problem: You are using background-position with background-image property
Solution: Either use only background property or use background-position separately
background: color url(src) repeat position;
or
background-image: url(src);
background-position: position;
Your code should like this:
background: url("../images/icon_twitter.png") 0 0 no-repeat;
Note: You should use px (or any other unit) with non zero numbers and zero should be used without unit.

Aligning two UL's to same baseline with CSS

Trying to get two UL's to align to a single baseline, while having one UL flush left and the other UL flush right.
Currently, the UL's do not align and appear like this:
How do I get the two UL's to share the same baseline?
CSS
#footer ul,
#footer li,
#footer span,
#footer a {
margin: 0;
padding: 0;
position: relative;
}
#footer {
list-style-type: none;
padding: 0;
margin-left: 21px;
margin-right: 20px;
text-decoration: none;
}
#footer a{
text-decoration: none;
padding: 0 7px;
color: #777;
}
#footer li {
display: inline;
}
#footer li > a {
color: #000;
font-size: 11px;
font-weight: bold;
text-decoration: none;
color: #777;
}
#footer li:hover a {
color: #71979f;
}
#social ul,
#social li,
#social span,
#social a {
margin: 0;
padding: 0;
position: relative;
}
#social {
margin: 0 31px 0 0;
padding: 0;
height: 15px;
}
#social li {
margin: 0 8px 0 0;
padding: 0;
list-style-type: none;
height: 15px;
float: right;
}
#social li.last{
margin-right:0px;
}
#social li a {
background-image: url("../images/icon_social.png");
background-position: 0px 0px;
background-repeat: no-repeat;
display: block;
height: 15px;
width: 18px;
}
#social li#social-twitter a{
background-position: 0px 0px;
}
#social li#social-twitter a:hover {
background-position: 0px -15px;
}
#social li#social-youtube a{
background-position: -18px top;
}
#social li#social-youtube a:hover {
background-position: -18px -15px;
}
#social span {
display: inline;
font-size: 11px;
color: #777;
}
HTML
<div>
<ul id="social">
<li id="social-youtube" class="last"></li>
<li id="social-twitter"></li>
<li id="social-text"><span>STAY CONNECTED</span></li>
</ul>
<ul id="footer">
<li><a href='#'><span>Blog</span></a></li>
<li><a href='#'><span>Contact</span></a></li>
<li><a href='#'><span>Knowledgebase</span></a></li>
<li><a href='#'><span>Site Map</span></a></li>
<li><a href='#'><span>Privacy/Legal</span></a></li>
<li><a href='#'><span>Mailing List</span></a></li>
</ul>
</div>
ul tags are block elements you may need to float them and assign the same height:
#social {
float:right;
height:20px;
}
#footer {
float:left;
height:20px;
}
The demo http://jsfiddle.net/CvLt9/2/
#social, #footer{ vertical-align:bottom; }

Drop down position

Having some problems getting the drop down menu position or mainly the background of it in place with the links from drop down menu, can't figure out what could be the problem... Here's the CSS code (menu li ul) image on how it looks -> http://i.imgur.com/9VjpW.jpg or jsFiddle http://jsfiddle.net/F5wCG/3/
.menu ul{
background-color: transparent;
height: 25px;
list-style: none;
margin: 0;
padding: 0;
position: relative;
clear: left;
float: right;
text-align: center;
right: 50%;
}
.menu li{
float: left;
padding: 0px;
position: relative;
left: 50%;
margin: 0px;
list-style: none;
}
.menu li a{ /* Where main link names are etc */
background: #333 url("images/seperator.gif") bottom right no-repeat;
color: #CCC;
display: block;
font-weight: normal;
line-height: 35px;
margin: 0px;
padding: 0px 25px;
text-align: center;
text-decoration: none;
}
.menu li a:hover, .menu ul li:hover a{
background-color: #2580A2;
background-image: url('images/hover.gif');
background-position: bottom center;
background-repeat: no-repeat;
color:#FFFFFF;
text-decoration:none;
}
.menu li ul{ /* Drop down menu */
background-color: #333;
display: none;
height: auto;
border: 0px;
position: absolute;
width: 225px;
z-index: 200;
padding: 0px;
margin: 0px;
border: 0px;
}
.menu li:hover ul{
display: block;
}
.menu li li {
background: url('images/sub_sep.gif') bottom left no-repeat;
display: block;
float: none;
width: 220px;
}
.menu li:hover li a{
background: none;
}
.menu li ul a{
display: block;
height: 35px;
font-size: 12px;
font-style: normal;
margin: 0px;
padding: 0px 10px 0px 15px;
text-align: left;
}
.menu li ul a:hover, .menu li ul li:hover a{
background: #2580A2;
background-image: url(images/hover_sub.gif);
background-position: center left;
background-repeat: no-repeat;
border: 0px;
color: #FFF;
text-decoration: none;
}
.menu p{
clear: left;
}
http://jsfiddle.net/F5wCG/4/
Basically remove
.menu li { left: 50% }
and add
.menu li a {left:0; }

Resources