The issue I am facing is that the <a> element is not being styled properly within the <li> tag. When I inspect the

Having some trouble with my styling here. None of it seems to be showing up and I keep getting 'invalid property value' errors for all the assigned values.

Let's take a look at the provided HTML and CSS:

HTML:

<div>
  <img style="width: 40%" src="https://i.imgur.com/wNLc5fC.jpg">
  <div>
    <h2>Digital Assets For Creative Professionals</h2>
  </div>
  <div>
    <ul>
      <li>
        <a href="" class="btn1">Photo</a>
      </li>
      <li>
        <a href="" class="btn1">Video</a>
      </li>
      <li>
        <a href="" class="btn1">Motion</a>
      </li>    
    </ul>
  </div>
</div>

CSS:

h2 {
  position: absolute;
  z-index: 1;
  top: 140px;
  color: #FFF;
  padding-left: 4%;
}

ul { 
    position: absolute; 
    z-index: 1;
    top: 290px;
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    margin-left: 10em;
}

li {
  float: left;
  padding-right: 40px
}

a.btn1 {
 display: inline-block;
 padding: 0.3em 1.2em;
 margin: 0 0.3em 0.3em 0;
 border-radius: 2em;
 box-sizing: border-box;
 text-decoration: none;
 font-weight: 300;
 color: #FFFFFF;
 background-color: #4eb5f1;
 text-align: center;
 transition: all 0.2s;
}
a.btn1:hover{
 background-color: #4095c6;
}

I would really appreciate any help or advice on this issue.

Initially, I thought it might be a browser problem, but I haven't noticed anything unusual there. I even tried testing this code in other browsers like Firefox, but the problem persists.

Thank you very much!

Answer №1

You have some unknown unicode characters in your CSS code for a.btn and a.btn:hover

To resolve this issue, I have replaced the problematic characters with blank spaces.

https://i.sstatic.net/Dkyfi.png

h2 {
  position: absolute;
  z-index: 1;
  top: 140px;
  color: #FFF;
  padding-left: 4%;
}

ul { 
    position: absolute; 
    z-index: 1;
    top: 290px;
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    margin-left: 10em;
}

li {
  float: left;
  padding-right: 40px
}

a.btn1 {
  display: inline-block;
  padding: 0.3em 1.2em;
  margin: 0 0.3em 0.3em 0;
  border-radius: 2em;
  box-sizing: border-box;
  text-decoration: none;
  font-weight: 300;
  color: #FFFFFF;
  background-color: #4eb5f1;
  text-align: center;
  transition: all 0.2s;
}
a.btn1:hover{
  background-color: #4095c6;
}
<div>
  <img style="width: 40%" src="https://i.imgur.com/wNLc5fC.jpg">
  <div>
    <h2>Digital Assets For Creative Professionals</h2>
  </div>
  <div>
    <ul>
      <li>
        <a href="" class="btn1">Photo</a>
      </li>
      <li>
        <a href="" class="btn1">Video</a>
      </li>
      <li>
        <a href="" class="btn1">Motion</a>
      </li>    
    </ul>
  </div>
</div>

Answer №2

When the CSS code resides in a separate file, it is important to check for any syntax errors in your link and ensure that you have saved the file before loading the page. I tested your code by placing it within the style tag in the HTML file, and it appears to be functioning correctly.

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

Is there a way to modify just the homepage url of the logo on a WordPress website using the OceanWP theme?

My website, abc.com, is set up with Angular for the homepage and WordPress for the blogs. The WordPress site is located in a subfolder within abc.com. You can see the file structure in the image below. I am now looking to change only the homepage link on ...

Issues with the OnChange function not properly functioning in duplicate input fields

I've designed a form that allows for adding or deleting rows, effectively cloning input fields. One of the input fields utilizes Jquery Ajax to retrieve its value. However, upon adding an extra row by cloning the parent row to generate a child row, th ...

Creating a dynamic image carousel using jQuery

Today, I completed the jQuery course on Code Academy and am now trying to create an image slider using it. While I have a general idea of how it should work, I feel like I'm missing a key element. My goal is to have the slider continuously running whe ...

In Chrome, the computed style of background-position is returned as 0% 0%

Let's say I have an element and I am interested in finding out its background-position: To achieve this, I use the following code snippet: window.getComputedStyle(element).getPropertyValue('background-position') If the value of background ...

Analyzing the string's worth against the user's input

I need help figuring out how to save user input on a form (email and password) as variables when they click "Register", so that the data can be used later if they choose to click "Login" without using default information. I am working on this project for s ...

Steps for creating a dynamic progress bar with inverted text style using only CSS

I am working on creating a dynamic progress bar with inverted text color using only CSS. To see examples of what I am trying to achieve, you can refer to the following links. Inverted Colors CSS progress bar CSS Progress Bars https://i.sstatic.net/VSs5 ...

Require a selection from the menu on the right side needed

I am looking to have the logout link displayed on the far right when the other menu items are hidden. Currently, it is appearing in the center. Is there a way I can make it show up on the right? <div class="nav-content container"> &l ...

Is it possible to keep the screen in the same position using Javascript or jQuery, even after refreshing the page?

On my page for live scores results, there are two sections - the top section displays live match results and information, while the bottom section is dedicated to comments. When I submit a comment, the page refreshes and goes back up to the information sec ...

What is the best method for extracting one specific data point from a database table?

Currently, I am faced with a challenge in fetching data from one database table to another. Despite successfully utilizing SQL's JOIN feature for this task, I still struggle with isolating a single result from the database and showcasing it on the res ...

Trouble in Paradise: Woocommerce Product Grid in Disarray

Currently working on a WordPress WooCommerce website and encountering an issue with the product listing. Despite trying various plugins and CSS adjustments, I am unable to correct the positioning problem. Strangely, everything seems to be functioning prope ...

Adjust the background hue and opacity when incorporating a "modal div"

Currently, I have a page where a hidden div appears at some point to display a form for inputting data. This could be considered a modal div. My goal is to darken the rest of the page and only allow interaction with this specific div. I want the backgroun ...

What are some ways to enhance mobile browsing with CSS?

I'm facing a challenge with optimizing my webpage for different mobile resolutions in my beginner HTML/CSS course. Whenever I use a website resolution simulator to test, the layout doesn't look right on certain settings. Is there a method to aut ...

Ways to divide the value of an input text box using Angular

Given the value "<HR>*10/100", how can I split it into three parts: "HR", "*", and "10/100"? HTML <input type='text' ng-model='value' ng-change="GetAngValue(value)"> {{Result}} Angular $scope.GetAngValue = function (val ...

Navigating within fixed-positioned divs

I'm attempting to create something similar to the layout seen on: The desired effect is to have fixed content on the right side, with only the left side scrolling up to a certain point before the entire page scrolls normally. However, in my implement ...

Modify the color of a div element in React when it is clicked on

My goal is to change the color of each div individually when clicked. However, I am facing an issue where all divs change color at once when only one is clicked. I need help in modifying my code to achieve the desired behavior. Below is the current implem ...

How to use CSS and Jquery to show a child element right after its parent element

I'm attempting to develop tabbed navigation using my current HTML structure. My goal is to display book titles as tabs and book details BELOW the tabs. Check out this example: or view this: http://jsfiddle.net/syahrasi/Us8uc/ I cannot change the HTM ...

I'm having an issue with my Bootstrap tabs - they seem to be unresponsive when clicked

I've been working on a Bootstrap website and have run into some issues that I can't seem to resolve. One problem I encountered was with a set of tabs that were supposed to be interactive, but for some reason, they weren't working as expected ...

How is it that the browser can determine my preferred font when all of them are labeled as Roboto?

Forgive my lack of expertise, but I have a question to ask... I've come across many examples that use the following method to load fonts from a local server: @font-face { font-family: "Roboto"; src: local(Roboto Thin), url("#{$robot ...

Tips for eliminating the gap separating the authentication design from the additional elements within the Laravel, Vue, and Inertia framework

I'm currently working with Laravel and Vue using Inertia. When I log into the system, the authentication layout creates a space at the top of the page. How can I resolve this issue? Here is an image highlighting the space I need to remove, marked wit ...

What's the significance of the #/ symbol in a URL?

Currently, I am developing Ruby on Rails web applications. The URL of my webpage appears as follows: http://dev.ibiza.jp:3000/facebook/report?advertiser_id=2102#/dashboard From this link, I have identified that the advertiser_id is 2102 but I am unsure a ...