How can I make a DIV cursor and background color change if I hover over it?
Tags: html,css
Problem :
I have this HTML code:
<div class="authTabs">
<div class="h2">Login</div>
<div class="h2">Register</div>
</div>
I am using CSS. Can someone tell me how I can make it so that my cursor changes to a finger pointing and my background color changes when the Login or Register DIVs are hovered over?
Solution :
See DEMO
.authTabs {
cursor: pointer;
}
.h2:hover {
background-color: red;
}
CSS Howto..
If you want it to stretch to the right edge you should make the ul items display: table; and width:100%;. While the li items should be display:table-cell;. .nav-wizard { display:...
setting the overflow should take care of it, but you need to set the height of Content also. If the height attribute is not set, the div will grow vertically...
You should be able to do what you want by adding the following to your rotate class: white-space:nowrap; width:1.5em; /* whatever width you want */ overflow:visible; Updated snippet: .rotate {...
The whitespace (carriage return included) is usually rendered as space in all browsers. You need to put the elements one after another, but you can use a trick: <a href="page1.html"><img...
z-index is a CSS property that sets the stack order of specific elements. An element with greater stack order is always in front of another element with lower stack order....
You can use canvas' transformations to draw your angled ladder: save the unrotated context state: context.save(); translate to the beginning of your line: context.translate(x,y);. rotate to the same angle as...
You can try like this - * { box-sizing: border-box; } .container { position: relative; height: 256px; width: 256px; } .inner { float: left; margin-right: 16px; border: solid 1px red;...
Transition properties are comma delimited in all browsers that support transitions: .nav a { -webkit-transition: color .2s, text-shadow .2s; /* And so on... */ } Ease is the default, so...
Apply overflow: hidden to the form. Move the margin on the inputs inside form to form itself. See: http://jsfiddle.net/eb2zR/1/...
Place your image inside the centered div. Give the centered div position:relative. Now give the image position:absolute and left:-XXpx where XX is the width of your image.
If you are instantiating it for the other elements in your DOM why not using something like: $('label').click(function() { $.material.checkbox(); }); See Example A. or maybe use CSS to disable...
The js for this drop down menu seems to have been last updated in 2008 so be a little cautious as to its compatibility with modern browsers and technologies. I...
.container { /* remember to set a width */ margin-right: auto; margin-left: auto; } Here's the fiddle: http://jsfiddle.net/d9yBs/ You can also combine to 2 margin properties, and use the shorthand:...
You can replace inline attributes height='40' width='40' with inline css like this .data('autocomplete')._renderItem = function(ul, item) { return $('<li>') .data('item.autocomplete', item) .append("<a>"+"<img src ='/account/"+item.id+"/icon/logo' onerror='$(this).hide()' style='width:40px;height:40px'...
I don't think so. If you don't use shadow DOM you can't have scoped CSS. One alterantive is to keep shadow DOM and change the CSS you applied to your...
So, one way of doing it in jQuery would be to set all images, by default, to have the attribute: data-pin-no-hover="true" The jQuery for this would simply be: $("img").attr("data-pin-no-hover", true);...
If you really want to do this you can try something like this: .overlay { height: 400px; .categoryHero & { height: 200px; } } The trailing ampersand will select the...
One possible solution is to use opacity: 0 instead of display: none and using transition on hover: #menu { width: 100%; margin: 10px auto; } #menu ul, #menu li {...
If your markup is effected with a plugin or js or some scripts then the absolute position will only be override rather using relative just use static like this table.fc-border-separate...
You have a really complicated structure. Here's what your code could look like when simplified: http://jsfiddle.net/hCmrY/2/ Let me know if there are any Safari issues with it....
The short answer is that you can't. This image from MDN's explanation about stacking context explains it well: There has been talk about escaping stacking context using position: fixed but it...
Here is one solution: EXAMPLE HERE Change .tooltip from inline to inline-block: .tooltip { display: inline-block; position: relative; } Then remove the absolute positioning from the child img element. This...
* { margin: 0px; padding: 0px; } html, body { height: 100%; } .header, .footer { height: 80px; background-color: #EFEFEF; } .header-content { padding: 20px; text-align: center; } .headerleft {...
Here's how to get precise centering without using the offset classes: Fiddle Demo Create a new helper class called col-centered: .col-centered { float: none; margin-right: auto; margin-left: auto; } Any...
Simple answer, given how CSS works: CSS doesn't care about where it's declared, it kicks in globally. If you have a rule div { ... } then that applies to...
Update: 10/21/2015: The following answer required you to explicitly provide values such as 100em in order to achieve offsets. This is not ideal. Instead, you can translate the element. Update...
Hello you mistake was in the if-statement. if(count == sc){ count == 1; }else{ count = count + 1; } You wrote count == 1; instead of count = 1;...
I could do it myself!!! First you have to draw the four corner“s highlights on HTML: <img id="clt" src="img/clt.png" border="0" style="position:absolute;visibility:hidden"></span> <img id="crt" src="img/crt.png" border="0" style="position:absolute;visibility:hidden"></span> <img id="crb"...
give the bar a position of fixed, and set its bottom to 0px, then set your menu to have a bottom of the height of your bar, in this case...
overflow: scroll doesnt work in Android 2.3.x, you will need to build the scrolling yourself by listening for drag events. see the iScroll library...