Solved

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

Posted on 2013-05-22
6
190 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
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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 33

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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
css selector 1 17
Call a function within the ASP code 4 12
Html form and modal / img src -problem 3 12
Create an automated page index 9 19
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

831 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