Hi everyone
For those of you who have helped me over the years, thank you things are starting to come together. I am doing codeacdemy tutorials almost daily and I am really gaining a solid understanding of css and even programming.
My current problem is probably not that hard to fix, but I do need some guidance.
I am working a project with twitter bootstrap to build a web app. I have used the class .btn along with the class .up in my html. This styles a little button with a lot of css3 properties attached to it and is great, but is not for me.
I have created a little gif of a tick and a cross, kind of like for yes or no. I added another class to my html called voteyes, and the string everything together in my stylesheet, something lie this
.btn, .up, .voteyes {
Background-image: ......
}
I got my background image but ofcourse all of the other style was there. I could have gone in and set the display to none on each property, however I knew there was a better way. Just trying to go through this in my head here, but I have not done a lot of pseudo selector stuff previously.
I think I need to set an active, hover and clicked state for cool custom button. I also need to position it within it’s containing element, which I think I will do with margin alone. Not sure if I should do this as a % (i avoid %) as I am using bootstrap responsive. I’ll prob just use media queries to collapse but it’s so small I think it will still function in it’s form.
So I am looking for a good resource to creating making custom buttons. Here is my go at it. (off top of head not tested so excuse poor syntax).
There are three states. Unselected, hover, and selected.
I’m not sure on the size of the container, or if I need set a height or width. The image is very small
.voteyes a:link {
Background-image: url (‘../images/tick.gif’);
Margin: auto 0; /* I can figure it out later in terms of position*/
Display: inline;
Text-align: -999px; /* accessibility */
Height: 10px;
Width: 10px;
}
.voteyes a:hover {
Background-image: url (‘../images/tickhover.gif’);
Margin: auto 0; /* I can figure it out later in terms of position*/
Display: inline;
Text-align: -999px; /* accessibility */
Height: 10px;
Width: 10px;
}
.voteyes a:active {
Background-image: url (‘../images/tickhover.gif’);
Margin: auto 0; /* I can figure it out later in terms of position*/
Display: inline;
Text-align: -999px; /* accessibility */
Height: 10px;
Width: 10px;
}
Cheers



Reply With Quote





You're right - background, not background-image.

Bookmarks