Solved

Click-able bullets CSS

Posted on 2015-02-13
3
163 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 500 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

Report: Liquid Web beats Amazon, Rackspace & More

A study by performance analyst firm Cloud Spectator finds that Liquid Web beats rivals Amazon, Rackspace and DigitalOcean when it comes to website and cloud application performance.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Anyone familiar with PhotoSwipe? 3 39
w3c parsing errors 4 36
Presenting my portfolio on the web? 11 50
ReadyAPI 1.9.0 2 38
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
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…

739 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