Anchor tag buttons do not affect the font color and variables remain unchanged

I've been struggling to change the font color and background color of the <a> element, but nothing seems to work. I've attempted using hexadecimal notation and styling the .btn class without pseudo-classes, with no luck.

Check out my CodePen here

@import url('https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@700&family=Lexend+Deca&display=swap');

:root{
    --bright-orange: hsl(31, 77%, 52%);
    --dark-cyan: hsl(184, 100%, 22%);
    --very-dark-cyan: hsl(179, 100%, 13%);
    --transparent-white: hsla(0, 0%, 100%, 0.75);
    --very-light-gray: hsl(0, 0%, 95%);
    font-size: 15px;
}
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.btn:any-link{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    width: 150px;
    border: 2px solid var(--very-light-gray);
    border-radius: 50px;
    background: var(--very-light-gray);
    font-family: 'Lexend Deca', sans-serif;
    text-decoration: none;
}
.btn--1:any-link{
    color: var(--bright-orange);
}
.btn--2:any-link{
    color: var(--dark-cyan);
}
.btn--3:any-link{
    color: var(--very-dark-cyan);
}
.btn:hover,
.btn:active{
    color: var(--very-light-gray);
}
.btn--1:hover,
.btn--1:active{
    background: var(--bright-orange); 
}
.btn--2:hover,
.btn--2:active{
    background: var(--dark-cyan);
}
.btn--3:hover,
.btn--3:active{
    background: var(--very-dark-cyan);
}
<a class="btn btn--3 showcase__btn" href="#">Learn More</a>
<a class="btn btn--3 showcase__btn" href="#">Learn More</a>
<a class="btn btn--3 showcase__btn" href="#">Learn More</a>

Answer №1

To achieve the desired result, follow these steps:

.btn{  
  color: var(--dark-cyan) 
}

As mentioned by @Martin, omitting the :any-link is sufficient. For more detailed information, visit this informative website.

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

Troubleshooting problem with CSS overflow and absolute positioning on Android Browser

Our mobile web app was created using a combination of JQuery Mobile, PhoneGap, and ASP.net MVC. It is designed to function smoothly on both iOS and Android devices regardless of the browser being used. We have conducted tests on various devices and everyth ...

Send an array of data from the view to the Controller in CodeIgniter

I have been searching for a solution to this question. However, for some reason, my code is not functioning properly. Here is what I want to achieve: Data Array -> ajax post -> codeigniter controller(save data in DB and redirect to another page) ...

Challenges with unique scrollbar designs and dynamic tab loading using AJAX

Hello to all amazing members of stackoverflow, I'm facing some major challenges getting my custom scrollbar to function properly with ajax-based tabs. Any assistance you can provide would be immensely helpful. I have most of it set up and operational ...

The Disabled element does not exhibit effective styling

When we include the disabled attribute in the text element, the style does not work. Can you explain why? <input pInputText [style]="{'padding-bottom':'10px','padding-top':'10px','width':'100%&apos ...

Unexpected data being passed in knockout click event binding

for (let i = 0; i < 9; i++) { vm.icdCodes.push({Index:i, ID:'',DiagnosisCd: '' ,Description:ko.observable('')}); } <tbody data-bind='foreach: $root.icdCodes'> <tr> <td> ...

Identifying clicks on various indices within a common class or element

My website has a navigation menu with unordered list items in it. <nav> <ul> <li id="zero"></li> <li id="one"></li> <li id="two"></li> </ul> </nav> I am working on implementing J ...

Submitting a PHP form by uploading an image with AJAX

I'm looking to submit form data to a MySQL database using AJAX. While I'm not very familiar with AJAX, I managed to write a code that successfully submits text data to the database. However, I'm facing issues with uploading and storing image ...

Add CSS styling to a particular div element when a button is clicked

I have been working on a new feature that involves highlighting a div in a specific color and changing the mouse pointer to a hand cursor. I successfully achieved this by adding a CSS class: .changePointer:hover { cursor: pointer; background-color ...

Adjust the CSS within a <style> element using jQuery or javascript

What I aim to accomplish: I intend to dynamically add and modify rules within a <style> tag using JavaScript/jQuery. Reason behind this goal: I am in the process of creating a color scheme editor where changes made by the user should be reflected ...

Ways to conceal a div element when the JSON data does not contain a value

If the value in "desc" is empty, then hide <div24> and <popup-desc>. html <div class="popup"> <div class="popup-top" style="background-color: '+e.features[0].properties.fill+';"> ...

Reposition the jQuery tooltip arrow

I need help adjusting the position of the arrow to the left near the text box. Can anyone assist with this? Here's what I've tried so far: Check out the working example here: http://jsfiddle.net/b8fcg/ HTML: <input id="test" title="We ask ...

Steps for retrieving the currently selected text inside a scrolled DIV

An imperfect DIV with text that requires a scroll bar For example: <div id="text" style='overflow:scroll;width:200px;height:200px'> <div style='font-size:64px;'>BIG TEXT</div> Lorem Ipsum is simply dummy text of th ...

Switch out div elements for td elements in HTML code

I have written a code snippet that successfully toggles between showing and hiding content. Here is the code: Simple collapsible Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliq ...

What causes the bootstrap grid system to deviate from the intended column sizes?

Here is the alignment I am aiming for with the Phone and Extension fields in the form: https://i.sstatic.net/JRmDU.png This is the code snippet I have written for the Phone and Extension row: <div class="row form-group"> ...

What is the process for populating a checkbox with data from a configuration file using JavaScript?

I have a requirement where I need to populate a list of checkboxes with data from a configuration file. To elaborate, if my checkboxes are meant to select sports, within my JSON configuration file I have an array like this: sports: ["Tennis", "Rugby", "S ...

What are the ways to recognize various styles of handlebar designs?

Within my project, I have multiple html files serving as templates for various email messages such as email verification and password reset. I am looking to precompile these templates so that they can be easily utilized in the appropriate situations. For ...

What is the technique for rearranging columns to be at the top in Foundation for mobile devices?

On my desktop, I have a layout like this: [Column1 large-8] [Column2 large-4] For mobile view, I'd like it to be like this: [Column2 large-4] [Column1 large-8] Below is the code snippet I am working with: <div id="search-content" class="row ma ...

Closing an Electron Dialog triggers a refresh on my current page

I currently have an Electron application in place. It utilizes Bootstrap v4, Electron v2, as well as other node modules. One concern I am facing is related to a button that triggers an Electron dialog box where users can select a folder. Upon selecting th ...

The issue with jquery slideToggle is that it mistakenly opens all divs instead of just the specific div that should

My website has a dynamic page with a variable number of <div> elements. The concept is that users can click on the + symbol, which is represented by an <img> tag, to display the corresponding div. Currently, my code includes: PHP/HTML $plus ...

What is the maximum number of JavaScript functions allowed in a single HTML file?

My HTML5 file includes JavaScript (created from CoffeeScript) directly within the HTML file, as I prefer this approach for my HTML/JavaScript programming. The code consists of four JavaScript functions that convert one temperature unit to another. Strang ...