Modifying the text color of a div class via CSS is not possible

I am currently facing an issue with styling a button made using a div. Despite my efforts to make the text white, the styling seems to be acting in unexpected ways.

Below is the CSS section:

.button a
{
    text-align:center;
    display:block;
    background-color: #FF0000;
    height:40px;
    line-height:40px;
    color:#FFFFFF;
    text-decoration:none;
}

.button  :hover
{
    background-color: #000000;  
}

You can view the page here.

On inspecting the page, you might notice that the text on the button is not turning white as intended.

Interestingly, when I include a:link and a:visited types within the CSS, it causes the header layout to collapse and the style gets applied to the TripAdvisor widget in the right sidebar, displaying like this:

Image link

Here is the HTML up to the button section:

<body>

<div id="wrapper">

    <header>
            <a href="index.html"><img src="images/logo.png" alt="Red 16 Cafe logo"/></a>
    </header>

    <nav>
        <ul>
            <li><a href="menu.html">Menu</a></li><li><a href="specials.html">Specials</a></li><li><a href="map.html">Map</a></li><li><a href="reviews.html">Reviews</a></li>
        </ul>
    </nav>


    <article>
        <div id="articletext">
            <a name="top"><h1>Our Menu</h1></a>
            <br>
            <div class="button">
                <a href="Red16MenuFeb2014.pdf">Download .PDF for printing</a>
            </div>

Answer №1

The code snippet below is causing the color:#FFFFFF; rule to be overridden.

Located in file style.css at line 138

#articletext a, a:link, a:visited {
    color: #000000;                    /* Line 138 in CSS */
}

To make the <h1> text black, you can simply remove the existing code and replace it with:

#articletext h1 {
        color: #000000;               
}

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

Designing a search form to browse through the database by entering a specific title

I am currently working on designing a form to perform database searches for specific titles. However, I have encountered an issue where nothing happens when I try to search, possibly due to a problem with connecting to the database. The link to the appli ...

Missing Input Field Placeholder Display

I am facing an issue with the placeholder text not displaying in the comments section of this code. The form structure is quite simple and constructed in a table format similar to the example provided below. Placeholder text seems to be functional for all ...

Utilize the :not() selector in combination with the :first-child() selector

Currently, I am seeking a method to merge two css selectors together in order to target specific elements. The selectors I am attempting to combine are ':not' and ':first-of-type'. Here is the code snippet that represents my current sit ...

The content beneath the Wordpress sidebar

After reviewing the articles which explained that when the sidebar goes under the content, it is usually due to a missing or extra div causing the sidebar to wrap out of place, or because the width of the content or sidebar is too wide. Despite thoroughly ...

Implementing dynamic element selection with jQuery: combining onClick and onChange events

I am looking to update the appearance of the arrow on a select option. By default, it is styled as caret-down. When a user clicks in the input area, I want to change the style to caret-up. If the select option has been changed or no action has been taken, ...

Adjust the positioning of a class element

I have an eye icon that changes position when clicked. Initially, it is set to left: 10%;, but if there is a DOM element with the ID login-section, it should be repositioned to left: 50%;. I attempted to use document.getElementsByClassName('fa-eye-sl ...

Viewing a Google Charts graph upon the loading of a web page

Utilizing the Google Charts library, I have incorporated a graphic on my web page that is dynamically added using AJAX into a <div> element. To display the graph when the page loads, I have written the following code: <script type="text/ ...

The responsive menu refuses to appear

my code is located below Link to my CodePen project I'm specifically focusing on the mobile view of the website. Please resize your screen until you see the layout that I'm referring to. I suspect there might be an issue with my JavaScript cod ...

Can you adjust the size of a container based on a breakpoint using a class name in Bootstrap 5?

I am currently working on styling a div using Bootstrap 5. I have a specific requirement where I want the container to have a width of 50 when the screen size is bigger than the medium breakpoint, and by default, it should have a width of 75. In Tailwind, ...

Creating a dual-direction infinite scroll effect with CSS through mouse dragging

I'm currently working on implementing an infinite scroll component for a project. After consulting this tutorial, I've encountered an issue. It seems that I can only achieve infinite scroll in one direction. Whenever I add elements to the leftmo ...

The backdrop hue conceals the dropdown menu background's shade

example I am currently facing an issue related to the appearance of my webpage. The image on the left shows how it looks without a background color set for the element with ID "landing-wrap", while the one on the right includes a background color for the ...

Using the device's width and height with material-ui

Currently, I am attempting to specify the width and height for only the (Iphone 7 Plus) within my project using withStyles. import { withStyles } from "@material-ui/core"; I have tested the following code: "@media (width: 414px) and (height ...

Images and CSS are failing to load on Magento2

After downloading and installing Magento 2, I encountered a 404 error for scripts and css. A specific example of my image path is: I attempted to address this issue with the following solution: By opening up app/etc/di.xml and locating the virtualType ...

What could be the reason for the hr tag's CSS not appearing in React code?

In my React code, I am trying to create a border using the following code: <hr className="borderLine" /> However, when I attempt to style it with CSS, I utilize this snippet of code: .divider { margin: 2rem; width: 100%; color: ...

Achieving Desired Styling Without Altering the HTML Structure: A Guide to CSS Formatting

Check out this HTML code: <head> <meta charset="UTF-8"> <title>Countdown</title> <style> /* CSS goes here */ </style> </head> <body> <ul> <li>one</li> ...

Incorporating Sass into Django

As I delve into my Django Project, one question looms large: where exactly should all my Sass files be placed? Is it more practical to create a central 'Sass' folder within the main Project Folder or designate a 'Sass' directory for eac ...

Material-UI LeftNav with a sticky header

I attempted to create a fixed header, specifically a Toolbar, inside a LeftNav so that when the LeftNav is scrolled, the Toolbar remains in place. However, for some reason, setting position: 'fixed' on the Toolbar does not work within the LeftNav ...

Removing empty table rows using JavaScript when the page loads

Within my HTML table, I have noticed some empty cells and rows that need to be removed. To give an example of the code: <table id="7"> <tr> <td>Name</td> <td>Type</td> <td>Parent</td> <td>Time</td&g ...

Unraveling a collection of HTML tags using Python's Beautiful Soup library

Need help parsing HTML code using Python Beautiful Soup. Trying to extract images along with their width and height properties, if available. The following code snippet indicates there are three images on a page: the first image is 300x300, the second has ...

Repairing the Left-sided Popup Leaflet

Can someone help me with fixing the positioning of the Popup to the left of the map? Currently, it does not stay aligned to the left edge when moving the map. I tried using position: fixed in my styling, and while everything looks good when zooming, it br ...