ultranova6600 Posted November 11, 2012 Share Posted November 11, 2012 Hi, I have a question regarding css property :hover. I saw on some pages that when you hover over a button it changes a color. Let's use this button as example: Let's say I want that a blue part changes a color on hover. How do I do it? My idea was to make other icons in photoshop with different style and put in hover like :hover{background: url('example.png')} Is there another way to do it in CSS like changing the text/background color on hover?Can elements control other elements (for example I want that when I hover over element1 that element 2 changes color?) or I need some browser scripting language for that? And whats the difference between div and span? Link to comment Share on other sites More sharing options...
Ingolme Posted November 11, 2012 Share Posted November 11, 2012 CSS image sprites are the most common way to do this: http://w3schools.com...age_sprites.asp <div> is block element, <span> is an inline element. Block elements take up the full width of their container and push content that follows it below. Inline elements can go within text without changing the flow of the page. Link to comment Share on other sites More sharing options...
ultranova6600 Posted November 11, 2012 Author Share Posted November 11, 2012 I understand, thank you. Link to comment Share on other sites More sharing options...
niche Posted November 11, 2012 Share Posted November 11, 2012 Remember that mobile doesn't hover Link to comment Share on other sites More sharing options...
ShadowMage Posted November 12, 2012 Share Posted November 12, 2012 Can elements control other elements (for example I want that when I hover over element1 that element 2 changes color?) or I need some browser scripting language for that?Yes, hovering on element 1 can change the style of element 2. Provided that element 2 is a descendant or sibling of element 1. If element 2 is a parent or completely unrelated to element 1, you'll need to use JavaScript. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now