Solved

Tying to use CSS in creation of an "X" button

Posted on 2013-05-22
6
192 Views
Last Modified: 2013-05-24
Hey all.

I've tried googling this and I can't find a viable solution.

What I want to do is mimic the way Netflix displays the "X" button when you remove an item from the instant queue, but I want to do it without images.

Is this possible? I've tried using a letter X and, on hover, adjusted the size, text-shadow etc but I can't get it to look the way I want.

Any ideas?
0
Comment
Question by:Webspeeder
[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
6 Comments
 
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 39189580
Can you post your code here?
0
 
LVL 6

Expert Comment

by:mickey159
ID: 39189795
Do you want this?

http://jsbin.com/ebidah/1/edit
0
 

Author Comment

by:Webspeeder
ID: 39190596
I can't really post code, as there is no code to post. Best I could do is try to get screenshot of before and on hover.

The JSFiddle page you posted doesn't do anything on hover. Basically it's an X that, when hovered over, it changes from a plain blue X on a white background to a white X on a blue background with the "background" being "raised". Sort of like it was inflated with air on hover, the edges would have some shadow effect making it look raised.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Webspeeder
ID: 39190612
Here are before and on hover screenshots.

Before hover
On Hover
0
 
LVL 8

Expert Comment

by:soupBoy
ID: 39191387
here is a 'proof of concept'....at best.

Adding x to list list item

I used an image for the x, but it is encoded as the background image, so no image to download, but the browser does have to build it.

Here is the HTML:
<div class="container">
    <ul>
        <li class="header row">
            <ul>
                <li>Header One</li>
                <li>Header Two</li>
                <li>Header Three</li>
                <li>Header Four</li>
                <li>Header Five</li>
            </ul>
        </li>
        
        <li class="row data">
            <ul>
            <li>item info</li>
            <li>item info</li>
            <li>item info</li>
            <li>item info</li>
            <li></li>
            </ul>
        </li>
        <li class="row data">
            <ul>
            <li>item info</li>
            <li>item info</li>
            <li>item info</li>
            <li>item info</li>
            <li></li>
            </ul>
        </li>
        <li class="row data">
            <ul>
            <li>item info</li>
            <li>item info</li>
            <li>item info</li>
            <li>item info</li>
            <li></li>
            </ul>
        </li>
    </ul>
</div>

Open in new window

Here is the CSS:
*, *:before, *:after{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
ul{
    list-style-type: none;
    display: block;
    width: 100%;
    overflow: hidden;
}

li li{
    float: left;
    width: 20%;
    display: block;
    text-align: center;
    min-height: 2em;
}
.header{
    background: #99CCFF;
    color: #333;
    font-weight: bold;
}
.row{
    display: block;
    border-bottom: 1px dotted #999;
    line-height: 2em;
}
.row:nth-child(even){
    background: #dedede;   
}
.data:hover{
    background: #999;
}

.cross{
    width:            20px;
	height:           20px;
	background-image: url('data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3NC83Nzc3Nzc3Nyw3Nzc3Mjc0Nzc3LDc3Nzc3Nzc3Nzc3NzcrN//AABEIABQAFAMBEQACEQEDEQH/xAAYAAACAwAAAAAAAAAAAAAAAAAFBwIEBv/EAC4QAAEDAgMGAwkAAAAAAAAAAAIBAwQFBgARExIUITFBUWFxoQciJDJCUrHh8f/EABoBAAEFAQAAAAAAAAAAAAAAAAUBAgMEBgD/xAAlEQACAQMCBQUAAAAAAAAAAAABAgMABBEFIRIxQVFhIjKx0fD/2gAMAwEAAhEDEQA/ADV/3BUyr6RG9SKzDNDaROCuF0PxTtgbcyPx4G2K1mk2luIONvUW5+PH3VOt3jOqcaLrObvu+RmTRKO2aci/XfDXndgM9KmttNghZsDOe/QdqYlkViVXLfZmzWSbcUlFCVMtVE5Gnn+UXF+By6ZIrN6jbpb3BSM5Hx4pc+0y5mZNbOFpD8CSghbPvkvXNe39xUuXy2O1GtKt+CIPn3Vg5kp51R1gIBIUIBUckVOi8eeKpBowjJggU/fZ9XDr9ssSnmgbdbJWTQB2RVRyyVE8lT1wVhfjTNYzUIBBOVByDvU7gsyi3BPjzajHJXmVTNWy2dUU+k+6euFeJXOTTILyaFSiHY/tqlcloUe448dmcyre75I0bGQEI/by+XwxzxK43pILuWAkqedGIMOPT4jUSEyLLDQ7IAKcETDwABgVA7s7FmOSa//Z');

background-repeat: no-repeat;
}
.cross:hover{
    cursor: pointer;
}

Open in new window

Here is the small amount of jQuery:
$('.data').hover(
    function(){
        $(this).find('li:last-of-type').addClass("cross");        
    },
    function(){
        $(this).find('li:last-of-type').removeClass("cross");    
    }
);

$('.data li:last-of-type').on('click', function(){
    alert('you clicked the x');
});

Open in new window

0
 
LVL 34

Accepted Solution

by:
Slick812 earned 500 total points
ID: 39191717
greetings  Webspeeder, , looked at the two Images, and the Hover you want to display, I really do not know the NetFlick methods to do this, , but below is some code that looks to me to do what you want.
<style>
.xbut {
width:16px;
height:16px;
text-align:center;
color:#000;
font-weight:bold;
line-height:16px;
font-size:15px;
font-family:arial,helvetica,sans-serif;
cursor:pointer;
}

.xbut:hover {
color:#fff;
background:#7cf;
-webkit-border-radius:4px;
-moz-border-radius:4px;
-ms-border-radius:4px;
-o-border-radius:4px;
border-radius:4px;
-webkit-box-shadow:inset -3px -3px 3px rgba(087,087,087,0.5);
box-shadow:inset -3px -3px 3px rgba(087,087,087,0.5);
}
</style>

<div class="xbut" onclick="doDelete();">X</div>

Open in new window

This works in a couple of different recent version browsers, BUT I know that the  "box-shadow"   and the  "border-radius" is NOT supported in some older browsers (especially I.E.)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

749 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