vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   CSS Hover Change Background... (https://vborg.vbsupport.ru/showthread.php?t=206390)

Winterworks 02-23-2009 10:33 PM

CSS Hover Change Background...
 
A part of my .css file is this...

Code:

.navigation_text {
        margin-left: 43px;
        width:155px;
        height:48px;
        text-decoration: none;
        font-size: 12px;
        color: #000000;
        background: #F8F8FF no-repeat top left;
       
}

Here's the code to match it in my index.html...

Code:

<div class="navigation_text"><strong>Website Homepage:</strong><br />Click <a href="http://www.website.com/index.html">here</a> to view our<br />homepage.</div>
Right now, on the site, the <div> box has a background color of #F8F8FF, which is exactly what I want. But I want it so when you put your mouse over it, the background of the whole box changes. I want it to change to white.

Not the links, or text, but background...

Yes, I'm just learning CSS. :p

TigerC10 02-23-2009 10:45 PM

Code:

<style type="text/css">
.navigation_text {
        margin-left: 43px;
        width:155px;
        height:48px;
        text-decoration: none;
        font-size: 12px;
        color: #000000;
        background: #F8F8FF;
}
.navigation_text_hover {
        margin-left: 43px;
        width:155px;
        height:48px;
        text-decoration: none;
        font-size: 12px;
        color: #000000;
        background: #FFFFFF;
}
</style>

<div class="navigation_text" onmouseover="this.className = 'navigation_text_hover'" onmouseout="this.className='navigation_text'"><strong>Website Homepage:</strong><br />Click <a href="http://www.website.com/index.html">here</a> to view our<br />homepage.</div>
}

There's probably a better way to do this using CSS hover properties, but those can be hard to deal with cross browser-wise.

Winterworks 02-23-2009 10:50 PM

It's not working...

TigerC10 02-23-2009 10:53 PM

Wow, really? Do you have javascript turned off or something? Because the "onmouseover" and "onmouseout" properties are reliant on javascript...


Try this instead:
Code:

<style type="text/css">
.navigation_text {
        margin-left: 43px;
        width:155px;
        height:48px;
        text-decoration: none;
        font-size: 12px;
        color: #000000;
        background: #F8F8FF;
}
.navigation_text:hover {
        margin-left: 43px;
        width:155px;
        height:48px;
        text-decoration: none;
        font-size: 12px;
        color: #000000;
        background: #FFFFFF;
}
</style>
<div class="navigation_text"><strong>Website Homepage:</strong><br />Click <a href="http://www.website.com/index.html">here</a> to view our<br />homepage.</div>


Winterworks 02-23-2009 11:06 PM

Okay, sorry, the first one worked, but when you hover it, then when you move your mouse away, it stays white. I want it to go back to normal when you move.

--------------- Added [DATE]1235437700[/DATE] at [TIME]1235437700[/TIME] ---------------

edit: nvm, it works now! thanks!


All times are GMT. The time now is 09:22 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00982 seconds
  • Memory Usage 1,721KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete