?
Solved

Click-able bullets CSS

Posted on 2015-02-13
3
Medium Priority
?
185 Views
Last Modified: 2015-02-16
I have a html list (like image attached) and I want to make:
- the bullet icons and text click-able
- The icons semi transparent.
- Then on hover the bullet icon not transparent.
- The text needs to stay white (not inheriting the opacity)

 example
I am struggling to make the icon click-able and semi transparent ... BUT the text not transparent.

<ul id="floorList">
   <li><a href="#">Ground Floor</a></li>
   <li><a href="#">1st Floor</a></li>
   <li><a href="#" >2nd Floor</a></li>
   <li><a href="#">3rd Floor</a></li>
</ul>

Open in new window


ul#floorList {
    list-style-type: none;
    padding: 0 20px;
    margin: 20px 0 0 0;
    text-transform: uppercase;
    width: 700px;
    float: right;
}

ul#floorList li{
	margin-bottom: 30px;
	float:left;
	width: 320px;
	padding-right: 10px;
}


ul#floorList li a{
    background-repeat: no-repeat;
	background-size: 50px 50px;
	background-image: url('images/icon_touch.png');
    opacity:1;
    padding: 10px 0 10px 60px;
	display: block;
	font-size: 25px;
	font-weight: 600;
	text-decoration: none;
	color: #FFF;
}



ul#floorList li a:hover, ul#floorList li a.active{
	opacity:1;
	background-color: #16A5B3;
}

Open in new window


Could anyone help.
0
Comment
Question by:Steve Tinsley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 40608735
Here's my attempt at it:
ul#floorList {
    list-style-type: none;
    padding: 0 20px;
    margin: 20px 0 0 0;
    text-transform: uppercase;
    width: 700px;
    float: right;
}

ul#floorList li{
	margin-bottom: 30px;
	float:left;
	width: 320px;
	padding-right: 10px;
}


ul#floorList li a{
    padding: 10px 0 10px 60px;
	display: block;
	font-size: 25px;
	font-weight: 600;
	text-decoration: none;
	color: #FFF;
	height: 50px
}
ul#floorList li a span {
	line-height: 50px;
	height: 50px;
	float: left;
	display: block
}

ul#floorList li a img {
	width: 50px;
	height: 50px;
	opacity: 0.5;
	float: left
}

ul#floorList li:hover a img {
	opacity:1
}

ul#floorList li a:hover, ul#floorList li a.active{
	opacity:1;
	background-color: #16A5B3;
}

Open in new window

<ul id="floorList">
   <li>
   	  <a href="#"><img src="img/images/icon_touch.png" alt="" /><span>Ground Floor</span></a>
   </li>
   <li><a href="#"><img src="img/images/icon_touch.png" alt="" /><span>1st Floor</a></span></li>
   <li><a href="#" ><img src="img/images/icon_touch.png" alt="" /><span>2nd Floor</a></span></li>
   <li><a href="#"><img src="img/images/icon_touch.png" alt="" /><span>3rd Floor</a></span></li>
</ul>

Open in new window

0
 
LVL 6

Accepted Solution

by:
Mikkel Sandberg earned 2000 total points
ID: 40608955
You can also use the :before pseudo-element if you don't want to change your HTML code.
So your HTML would stay the same, but then you can use this to create the icons using pseudo-elements:
a:before {
    background-image: url("http://icons.iconarchive.com/icons/icons8/ios7/128/Hands-Hand-icon.png");
    background-size: 20px 20px;
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    opacity: 0.5;
}
a:hover:before {
    opacity: 1;
}

Open in new window


Here's a simple demo on jsfiddle.

I'm not sure which is more semantically correct, but using pseudo-elements keeps your markup a little cleaner. Though it can make your styling a little more complicated.
0
 

Author Closing Comment

by:Steve Tinsley
ID: 40612528
Both answers would work perfect! I decided to use the last one!
Thanks
Steve
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question