Solved

Click-able bullets CSS

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
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?
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

724 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