Difficulty encountered with changing font color on CSS

I'm having trouble fixing the text color, it's currently white and blending in with the background. I've set the color to #1a6eb6 for both the TEXT element and the submenu list items, but it's not working. Can someone assist me with this?

Here is my HTML:

<div class="submenu">
    <ul>
    <li><span class="text"><a href="#">DISKUSNÍ FÓRUM </a></span><span class="horizontal-arrow"></span><span class="vertical-arrow"></span></li>
    <li><span class="text"><a href="#">KOMENTÁŘE </a></span><span class="horizontal-arrow"></span><span class="vertical-arrow"></span></li>
    <li><span class="text"><a href="#">ZÁZNAM CHATU </a></span><span class="horizontal-arrow"></span><span class="vertical-arrow"></span></li>
    <li><span class="text"><a href="#">UŽÍVATELÉ</a></span><span class="horizontal-arrow"></span><span class="vertical-arrow"></span></li>
    </ul>
 </div>

And here is my CSS:

.submenu{
    color: #1a6eb6;
    display: inline-block;
    height: 50px;
    width:780px;
}

.submenu ul {
    margin-left: 20px;
    padding-left: 0px;         
}

.submenu ul li{
    list-style-position: inside;    
    list-style-type: none;          
    background-image: url("images/shop_menu_bg.png");
    background-repeat: repeat-x;
    height: 38px;
    width: 187px;
    display: inline-block;
    color: #1a6eb6;         
}

/* Additional CSS styling rules... */

You can view the live preview here.

Answer №1

To make the font color change, you should include the color in .submenu ul li .text a

.submenu ul li .text a{
    color: #1a6eb6;
}

The reason why the font color wasn't changing is because your styles.css file contained the following style which was overriding the specified color for .submenu ul li .text

li a:link {
    color: #f7f7f7;
}

Answer №2

To ensure proper visibility, it is important to define the color of the <a> tag as the default white color may not be suitable for all backgrounds.

A suggested solution could be:

.submenu ul li a{
    color: #1a6eb6;
}

Answer №3

One common feature of user agent stylesheets is a rule that targets the a element and defines its color as a blue hue:

a:-webkit-any-link {
    color: -webkit-link;
    text-decoration: underline;
    cursor: auto;
}

However, if your own style.css file includes the following:

li a:link {
    color: #f7f7f7;
    font-weight: bold;
    text-decoration: none;
}

This will override the default stylesheet's rule and make the link appear white. To change the link color to a different shade, you must specifically target the a element like so:

.submenu a:link {
    color: #1a6eb6;
}

It is important to use the :link pseudo-class due to the specificity of the li a:link selector. Alternatively, you can use a more specific selector such as .submenu li a.

Answer №4

When it comes to modifying the color of your text, consider utilizing the "a" element in the following manner:

#submenu ul li a{

//insert your code here

}

Answer №5

To update the appearance of the element, modify line 183 in the CSS to:

li a:visited
{
color: #1a6eb6;
}

Alternatively, you can introduce a new CSS selector such as:

.submenu ul li a
{
color: #1a6eb6;
}

Answer №6

style.css line 183 - you are using li a:visited {color:#f7f7f7};

style.cc line 173 - the code contains li a:link {color:#f7f7f7;}

I found this information in the Chrome console. Please review these lines in your CSS file and consider removing the color:#f7f7f7 property.

You can also utilize the !important rule in CSS to ensure that a particular rule takes precedence over others. Learn more about what !important in CSS means here.

.submenu{
    color: #1a6eb6 !important;;
}

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

The final row continues to display the <div> element

Currently, I am in the process of learning PHP/MySQLi and there is something I need assistance with that I haven't been able to find a solution for online. In the forum script that I am developing, I have been using <div class="hr"> </div> ...

Finding the best way to transfer text between DIV elements?

I have a dilemma involving two DIV elements positioned absolutely on the sides of an HTML page, much like this EXAMPLE: <div class="left"> </div> <div class="right"> </div> These are styled using the following CSS: .left{ pos ...

Issue with Firefox position: absolute not producing the desired outcome

I am working on a webpage where I want to put a label over an image. I was able to achieve this using position: absolute for the label and float: left for the img tag. This method worked perfectly in most browsers, except for Firefox (both version 3 and 4) ...

Form tags are closing automatically on their own

Currently experiencing an issue where a form tag is mysteriously closing on its own. In the process of troubleshooting and pinpointing the root cause of this unexpected behavior. Inside the table structure due to Netsuite usage, which complicates the debu ...

Create a table that allows one column to have ample space, while ensuring that the other columns have uniform widths

This HTML/CSS creation features the following: https://i.stack.imgur.com/R8PRB.png However, the challenge lies in making the Very Good, Good, Fair, Poor, Very Poor columns equal in width while still allowing the "question" column to adjust its width acco ...

Incorporating header and footer elements into the design

I am facing an issue while editing a layout. Currently, when clicking on some side of the layout, a header and footer appear in a certain way. However, I would like to change this so that the header and footer appear differently, similar to the example s ...

Unlock the power of VueJS with advanced checkbox toggling for array data

I have encountered an issue while working with VueJS regarding the implementation of two features for a set of checkboxes. Initially, the checkboxes are generated dynamically. I am in need of a master 'toggle' checkbox that can toggle the stat ...

Mastering the art of combining images and text harmoniously

I am having trouble aligning my lion image and h1 tag side by side. There seems to be an issue but I can't figure out what it is. h2 { width:50%; float:right; padding:30px 0px 0px 0px; margin:0 auto; } .lion { width:10%; float: left; paddin ...

Encountered an error when attempting to submit with Node.js and Express.js connected to MySql - "Cannot POST /login

I am currently working on creating a basic login page using node.js with the express.js and mysql packages. The goal is to redirect users to the layout.html page if their username and password exist in the mysql database. For this project, I have set up a ...

Using HTML and JavaScript to implement a dragging functionality on a canvas element

After creating a square grid using HTML canvas, I've added a drag feature that allows users to draw rectangles by dragging over the grid. However, it seems that non-rectangle shapes can also be drawn in certain cases. Let's delve into an additio ...

jQuery not functioning properly when included in a separate JavaScript file

I'm facing an issue with my jquery code not working properly when I place it in a separate js file instead of embedding it directly into the html. Currently, my setup looks like this: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3 ...

Ways to troubleshoot the CSS padding issue

I've been wrestling with this landing page for the past day and I just can't seem to get the form section right. Take a look at this link! The form at the bottom of the page is all over the place. Below is the CSS snippet that I have been using ...

Ways to showcase a website within an HTML document using a URL?

Is it possible to show 2 webpages on a single aspx webpage? For instance, When a user opens the link for www.mywebsite.com, I would like to display both www.google.com and www.bing.com on my homepage. Behind the scenes, I will call two separate URLs an ...

extract all elements from an array nested within another array

I am having difficulty extracting data from an array file in PHP. I was able to read it and convert it into a PHP array, but now I want to display the stored information in a table, however, I keep getting incorrect values. How can I retrieve the informat ...

Why is it impossible for me to delete the class / property of this object?

Within a series of nested divs, there are additional divs containing multiple imgs. The goal is to cycle through these images using CSS transitions. To achieve this, a JavaScript object was created to track the divs, sub-divs, and images. Three arrays were ...

Revamping the Bootstrap framework in a major project

Currently, I am undertaking a project that involves the use of bootstrap 2.3.2 stylesheets along with bootstrap 3.0.0 .js scripts. The client side technology is significantly outdated and my primary objective is to update the bootstrap files to leverage th ...

The novice image slideshow script in JavaScript is causing all images to disappear and generating errors

Trying to create a simple image slider that pulls information from various sources. CSS and HTML are set up properly, but adding the JavaScript logic causes all images to disappear. The console displays an error saying "Uncaught TypeError: Cannot read prop ...

Learn how to design a customized loading screen using CSS with Phonegap

Currently working in Android with Phonegap / Cordova, I am faced with the challenge of optimizing page loading time due to numerous DOM objects being created. To address this issue, I am attempting to implement a "Loading..." screen to prevent users from b ...

Dynamically load WordPress content using ajax and incorporate CSS3 animations for added visual appeal

It's time for a new challenge to push my learning curve. I've never ventured into the world of ajax before, but it seems like a skill I need to acquire. What better opportunity to learn than by implementing it on a fresh portfolio site. The main ...

Automatic Clicks in the Chrome Console

I've come across a website that requires me to click on multiple elements scattered throughout the page Here is the code for one of the elements: <span class="icon icon-arrow-2"></span> Is there a way to provide me with the console comm ...