logo
down
shadow

How to change background colour of entire div on hover?


How to change background colour of entire div on hover?

By : user2955522
Date : November 22 2020, 10:40 AM
wish helps you ­I'm making a website and want to have a link inside a div that changes colour when hovered over, however I've come across a problem. Pre hover, I want a border around the div the same colour as the text in the link inside. The background colour should be white. Then, upon hover, I want the background colour to change to the colour of the text and border, and the text to become white. Because I have padding inbetween the link and div border, it doesn't quite work as intended. Here is the source html/css:
code :
#home {
    font-size: 30px;
    margin: 20px 100px 20px 100px;
    display: inline-block;
}
#home a {background: #ffffff;
    border: 4px solid #00a651;
    padding: 10px 20px 10px 20px;
         color: #00a651; 
         text-align: center;
}
#home a:hover {background: #00a651;
               color: #ffffff;
}
<div id="home">
    <a href="index.html">HOME</a>
</div>


Share : facebook icon twitter icon
how to change the background colour of entire body except a sidebar div

how to change the background colour of entire body except a sidebar div


By : user3809512
Date : March 29 2020, 07:55 AM
should help you out One way is to use box-shadow: inset -9999px 0 0 0 rgba(0, 0, 0, 0.25); on the header element.
Another way is to change the background-color of the header element.
code :
z-index: 100;
background-color: rgba(0, 0, 0, 0.5);
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1000;
position: /* Anything but static */
Change background colour of element upon hover css

Change background colour of element upon hover css


By : ZC Xing
Date : March 29 2020, 07:55 AM
seems to work fine I have some some HTML and CSS that's makes up a rectangle. Essentially I want to make it so when you hover over the square it changes colour. I've tried doing it already but it doesn't work. , Change your HTML/CSS to this (if this is what you are looking)
code :
#teamspeak_box {
    display: block;
    width: 159px;
    height: 43px;
    background: #212121;
    position: absolute;
    top: 0;
    right: 76px;
    border-radius: 0px 0px 5px 5px;
    transition: all 0.5s ease;
}
#teamspeak_box:hover {
    background: #C62828;
}
#teamspeak_box a {
    display: block;
    height: 43px;
}
#teamspeak_box_2 {
    display: block;
    width: 43px;
    height: 43px;
    background:#313131;
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 0px 0px 0px 5px;
}
#teamspeak_image {
    display: block;
    position: absolute;
    top: 5px;
    left: 5px;
}
#teamspeak_text {
    display: block;
    color: white;
    position: absolute;
    top: 14px;
    right: 10px;
    font-size: 16px;
    font-family:arial;
}
<div id="teamspeak_box">
    <a href="ts3server://craft412.serveminecraft.net:9987">
        <span id="teamspeak_box_2"></span>
        <span id="teamspeak_text">TEAMSPEAK</span>
        <img  id="teamspeak_image" src="//dummyimage.com/33x33" alt="TEAMSPEAK"/>
    </a>
</div>
Change background colour on hover over button

Change background colour on hover over button


By : MaxyD
Date : March 29 2020, 07:55 AM
will help you I want to be able to create a button which, when hovered over, changes the background colour of my website. , You can do it this way
code :
function bgChange(x) {
    document.body.style.background = x;
}
   

ul li{
  color:#fff;
  list-style-type:none;
  padding:2px;
  margin:7px;
}
ul li a{
color:#fff;
  padding:5px;
  }
<ul>
    <li><a href="" onmouseover="bgChange(this.style.backgroundColor)" style="background:red;">Red</a></li>
    <li><a href="" onmouseover="bgChange(this.style.backgroundColor)" style="background:green;">Green</a></li>
    <li><a href="" onmouseover="bgChange(this.style.backgroundColor)" style="background:blue;">Blue</a></li>
    <li><a href="" onmouseover="bgChange(this.style.backgroundColor)"
           style="background:yellow;">yellow</a></li>
 </ul>
Change background colour of whole div on hover

Change background colour of whole div on hover


By : Gustavo Peres Pessoa
Date : March 29 2020, 07:55 AM
hope this fix your issue The space after the class in the CSS, this causes any child elements to have the property applied instead. Remove the space, remove the issue
code :
.index-card {
  background: white;
}

.index-card:hover {
  background: red;
}
<div class="index-card" data-card-index="5">
    <div class="row">
        <div class="col-md-12 text-center">
            5
        </div>
    </div>
    <div class="row">
        <div class="col-md-12 text-center card-symbol">
            ה
        </div>
    </div>
    <div class="row">
        <div class="col-md-12 text-center"><i>He</i></div>
    </div>
    <div class="row">
        <div class="col-md-12 text-center">
            <i>H</i>
        </div>
    </div>
</div>
CSS on hover change background colour and text colour as well

CSS on hover change background colour and text colour as well


By : michael
Date : March 29 2020, 07:55 AM
hope this fix your issue I think I understand what you mean, the only reason why I don't think it worked was the way you tried to comment out the code, you were using // instead of /*.
Here's what I replaced it with:
Related Posts Related Posts :
  • Bootstrap3 - Removed container-fluid
  • Bootstrap framework not responsive for asp.net webform
  • How to align two inner divs inside outer absolute positioned div that has fixed width in which both divs have the same w
  • Div to ignore html tags
  • Prevent caching and stale content with a static web site
  • Is there a way to change the whole document with one selector in CSS?
  • why cant I click om my navigationbar links?
  • Is there a CSS/HTML way to cut multiple shapes out of the top/bottom of a div?
  • css border around multiple links/images
  • 'No data was received in the uploaded file', but file is not empty
  • How input boxes save previous entries
  • AMP carousel direction change
  • Bootstrap multiple carousel not working on thumbnails click
  • Is there a way to put a permanent space into an input field?
  • Html boxes not displaying properly
  • How can I change a variable in Jekyll _config.yml dynamically?
  • How can I prevent DIVs from overlapping a right floated image?
  • Eclipse and .tml files highlighting not working
  • Footer is not in the bottom of the window, (phonegap jquery mobile app for windows mobile)
  • How to put div over another
  • How to use glyphicons in bootstrap 3.0
  • Wordpress page links not working
  • How Do I Use CSS to Set the Color of An ALink?
  • Webpage doesn't scroll smoothly on screen
  • YouTube iframe, browser looks for file locally
  • html displaying inline image
  • Font acting differently on IE and Firefox
  • Encoding and decoding of the character references
  • An Image Button navigate to another site html/css
  • IE8 "Save Target as ..." won't display for block elements
  • Image hover transition for span - CSS
  • How to apply min and max on textarea?
  • How to draw multiple horizontal lines (Notebook Paper effect) using css?
  • Table Printing Issue: Gaps in top and Bottom Border of th Elements
  • grouping elements with div and applying stylesheet for that group
  • Click <div> to expand, then click again to shrink - Its expanding, just not shrinking
  • CSS - How can I center a <script>'s output?
  • Django's template variable gets interpreted as HTML
  • ngx datatable vertical scroll with rowheight set to auto
  • How to make input text border with CSS when it's OnFocus
  • Anyone know of a calendar web widget for my website I could use?
  • How does Bootstrap manage to use fixed positioning for navbar on iOS?
  • Centered text in fully clickable table cell
  • Compare HTML and HTML5
  • steps of creating webpage in bangla
  • css root element margin
  • What is the point of using absolute positioning in CSS?
  • Responsive solution for long URLs (that exceed the device width)
  • Divs don't collapse as they should - media queries
  • QTreeWidgetItem display html
  • Testing html/css image on local from jfiddle
  • long attribute value of HTML
  • Why my svg picture is truncated at the bottom when embedded in html
  • Display CSS: some divs fixed, some flexible (2)
  • How to append href strings with variables in html with PHP?
  • css - Why is there a big white space between text lines?
  • div image position fixed + scroll
  • Hide specific elements from html using css
  • how to align the arrow in menu item?
  • How do I create a trapezoidal button using CSS?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org