The changing hues of the header background color, now you see it, now

When the mouse pointer touches the header or any part of the body, I want the header background color to appear. Otherwise, I want the header background color to remain hidden.

<body>

    <div id="wrapper">

        <div id="header">
            <a  style="text-decoration:none" href="#" target="_blank">about.me</a>
            <button class="button">Log In </button>
            <button class="button">Create your page!</button>
        </div><!-- #header -->

        <div id="content">
          <div id="image">
               <center><img src="../../../../../wamp/www/check_php/IMG_9079.JPG"></center>
               <div class="clear_both" />&nbsp;</div>
               <div class="sub">
                <p align="center"><button class="button2">View my photos</button></p>
                <div class="clear_both" />&nbsp;</div>
                <p align="left">This is the power of a common man</p>
           </div> 
       </div><!-- #content -->


        <div id="footer">
           <p>Introduce yourself with a free, one-page website.
            <button class="button1">Get Started </button></p>
        </div><!-- #footer -->

    </div><!-- #wrapper -->

</body>

Answer №1

To give your HTML element a class, follow these steps:

       <div id="main-content" class="content-box">
            <p>Welcome to our website!</p>
        </div><!-- #main-content -->

Next, add the following CSS rules:

.content-box {
     border: 2px solid black;
}

.content-box:hover {
     background-color: lightgray;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Adapting pre-designed CSS for Sharepoint 2010

Currently in the process of integrating Bootstrap into my Sharepoint 2010 site and addressing issues as they arise. However, I am struggling to identify the class responsible for the 'hover' and 'active' effects in the Global Navigation ...

Simple steps to modify the width of underline using CSS

One of the cells in my table has the following content: <td><b>Grand Total</b></td> I want to add a line under the text "Grand Total". I tried using text-decoration: underline;, and it worked fine. However, I now need to customize ...

Flashing issues when utilizing the Jquery ui slider within an Angular 2 component

I recently incorporated a jquery-ui slider plugin into an angular 2 component and it's been working well overall, but I have encountered an annoying issue. Whenever the slider is used, there is a flickering effect on the screen. Interestingly, when I ...

Using d3.js to dynamically change the color of svg elements based on their data values

I was searching for a way to dynamically color SVG rectangles based on values from a dataset. If I were to create rectangles for each data entry, how could I adjust the rectangle's color according to the data value? Here is what I currently have: // ...

Steps to customize a CSS file within node_modules

Is there a way to make changes to a CSS file in the "node_modules" dependency without them being overwritten when I run npm install? I want to keep the modifications I've made to the node module files. ...

tips for obtaining necessary input fields

What is the best way to include mandatory input fields? appreciate it <input type="text" name="name"> ...

Menu Styled <ul> Not Activating handlerOut

My navigation menu is structured using an unordered list (<ul>) with customized styling (see markup & CSS below) <ul id="TopNavigation"> <li><a href="#" id="products" class="products">PRODUCTS</a></li> ...

Choose the initial p tag that includes an image, based on the content of another div

I am trying to figure out how to manipulate the code on my website: <div class="the-post-thumbnail"> <img src="" alt="" width="" height="" /> </div> <div class="post-body"> <p><img src="" alt="" width="" height="" ...

What steps can I take to improve the functionality of the slide navigation feature

I am currently working on implementing a sliding menu feature. The menu can slide open smoothly, however, I am encountering an issue when trying to close it by clicking on the 'x' button. let openNav = document.querySelector(".slideOpen"); ...

Guide to adjusting the number of bounces using jQuery's User Interface (UI)

Check out my code on CodePen: http://codepen.io/Chiz/pen/jbwPLO (click anywhere in the blank area) I'm trying to figure out how to adjust the number of bounces a div makes before stopping. For example, I want the div to bounce 10 times and also chang ...

Define the css settings for 'html, body' in Meteor for a particular page or route

I've been working on customizing the background CSS settings for a specific route or page in my Meteor app. To achieve this, I utilized Template.template.rendered/destroyed along with jQuery selectors to inject the desired CSS once the template is ren ...

What caused Safari to only show half of the page?

Whenever I browse my website using Safari, I noticed that if the total size of the content on the first page is less than 100vh, Safari ends up cutting off half of the page. To fix this issue, I added a CSS rule in the body setting min-height to 110vh wh ...

What is the best way to have a single item in a list displayed in two columns?

Can the angular repeat achieve this functionality? I am looking to loop the two elements together. Any assistance would be greatly appreciated! Controller: $scope.date=[ {ID:1,Date:'2016-11-12'}, {ID:2,Date:'2016-11-15'}, ...

Position the current div in the center of a bootstrap progress bar for mobile devices

I'm facing an issue with the bootstrap progress bar on my website, especially on mobile devices where it goes off the screen. I want the current page marker on the progress bar to be centered on the screen while allowing the bar to extend beyond the s ...

Traditional method of choosing a value within a <select> dropdown menu

Check out this example of a static dropdown menu: <select style="width:100px" name="drink_type"> <option value="Water">Water</option> <option value="Soda">Soda</option> <option value="Milk">Milk</option> < ...

My React application running on localhost is struggling to connect with the IPFS node

I'm currently working on a React component that allows users to submit a .jpeg file and upload it to IPFS. I've successfully started the daemon and can view the IPFS node in the IPFS-go-companion add-on with the following configurations: Gateway ...

Latest versions of Bootstrap are facing issues with the functionality of the Carousel feature

I'm struggling to create a basic carousel, but for some reason, it's not functioning properly. I attempted to use the sample code provided by Bootstrap's documentation, but it doesn't behave as expected (slides won't transition and ...

Issues with jQuery functionality occurring when trying to display or hide div contents on dynamically loaded AJAX content

I have encountered an issue while working on a project that involves showing or hiding a div based on the selection of a drop down value. The show/hide functionality works perfectly when implemented on the same page, but it fails when I try to do the same ...

What is the process to modify the font color on a webpage using a button?

I need some help figuring out how to change the font color on my website when someone clicks a button. I already have the background functionality working, but I can't seem to get the text color to change. This is the code I have so far: <div cl ...

Display various information with every "show details" button clicked on the Bootstrap Vue table row

My table has rows with multiple "More Details" buttons that, when clicked, reveal additional information specific to that row. The goal is to display information X when the first "More Details" button is clicked and information Y when the second "More Deta ...