Having trouble with my CSS ID selectors not activating as expected

I'm having trouble with my CSS styles not applying to certain IDs in Chrome and FF. Specifically, the IDs that are not working are 1_1, 1_2, and 1_3.

It's worth noting that the ID "buttons_menu" is functioning correctly.

Here is the HTML:

    <div id="buttons_menu">
        <div class="row">
            <div id="1_3" class="menu-item"></div>
            <div id="2_3" class="menu-item"></div>
            <div id="3_3" class="menu-item"></div>
        </div>
        <div class="row">
            <div id="1_2" class="menu-item"></div>
            <div id="2_2" class="menu-item"></div>
            <div id="3_2" class="menu-item"></div>
        </div>
        <div class="row">
            <div id="1_1" class="menu-item"></div>
            <div id="2_1" class="menu-item"></div>
            <div id="3_1" class="menu-item"></div>
        </div>
    </div>

This is the corresponding CSS:

   body{
    -webkit-tap-highlight-color:rgba(0,0,0,0);
    width: 1024px;
    height: 768px;
    background-color: white;
    margin: 0px;
    padding: 0px;
    position: relative;
    background: white url('../images/index/bg.png') no-repeat;
}
#buttons_menu{
    position:absolute;
    top:250px;
    left:66px;
    height:100%;
    width:100%;
}
.row{
    margin-bottom: 26px;
}
.menu-item{
    display: inline-block;
    border:1px solid black;
    margin-right: 5px;
    width: 209px;
    height: 122px;
}
#1_3{
    background: url('../images/index/1_3.png') no-repeat;
}
#2_3{
    background: url('../images/index/2_3.png') no-repeat;
}
#3_3{
    background: url('../images/index/3_3.png') no-repeat;
}
#1_2{
    background: url('../images/index/1_2.png') no-repeat;
}
#2_2{
    background: url('../images/index/2_2.png') no-repeat;
}
#3_2{
    background: url('../images/index/3_2.png') no-repeat;
}
#1_1{
    background: url('../images/index/1_1.png') no-repeat;
}
#2_1{
    background: url('../images/index/2_1.png') no-repeat;
}
#3_1{
    background: url('../images/index/3_1.png') no-repeat;
}

Answer №1

Did you know that an HTML ID cannot start with a number?. It's recommended to change them to something like some_prefix_1, etc.

For additional information and limitations in XHTML, refer to this helpful question- especially when considering the more permissive approach in HTML5.

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

Improving the utilization of variables in HTML

I was looking for a way to create dynamic user detail forms using a template. Each element needed to have a unique id for proper posting of details. This is what my template looks like: <div id="user-template" class="hidden"> <div class=&apos ...

I'm having trouble inserting my object into the scene: THREE.Object3D.add: the item is not a valid instance of THREE.Object3D

Recently, I started using three.js. Initially, I utilized a JSON file for my 3D model but encountered issues when exporting it from Blender. To resolve this, I decided to switch to obj files. Although the new obj model is working fine, I am struggling with ...

Can text be both vertically and horizontally aligned in a div at the center?

By using only one tag and the corresponding CSS, we can achieve center alignment. Take a look at this example: http://jsfiddle.net/EqTsu/ <style> #test{ width: 100px; height: 100px; text-align: center; border: solid 1px #f ...

What is the proper way to target a div element that has the class of "name1 name2"?

Currently, I am learning CSS through a tutorial and there is a div with the class: <div class="related products"> I am curious, how do I target this specific div in my stylesheet? ...

The retweet option is missing from Twitter Web Intents

I am trying to implement Twitter Web Intents to display modal windows for actions such as "Like" and "Retweet". Following the instructions from https://developer.twitter.com/en/docs/twitter-for-websites/web-intents/overview, my code looks like this: <h ...

How to align an unordered list vertically in the center using Bootstrap?

Trying to figure out why the ul within this parent div is not centered vertically. Here is a screenshot of the issue: https://i.sstatic.net/ZOc9M.png <div className=" d-flex align-items-center bg-primary "> <ul ...

Adjust the color of the hyperlink within the Lightbox feature

I am currently using Lightbox Plus. I made some changes to the link colors in the Lightbox.min.css file: .lightbox a{ color: #E74C3C; } .lightbox a:hover{ color:white; } .lightboxOverlay a:{ color: #E74C3C; } .lightboxOverlay a:hover{ color:white; ...

Accordion button refuses to compress

After following all the steps in my accordion lesson, I encountered an issue where my button refuses to collapse when clicked. Can anyone provide guidance on how to solve this problem? Adding a class of "show" allows the content to display, but it still d ...

DIV that floats and P element

When utilizing the float attribute, two div elements align next to each other, but two paragraph elements do not; causing the 'p' element to display oddly. Interestingly, when floating two 'div' elements and two 'p' elements, ...

Exploring ways to update the design of my navigation bar when clicked by utilizing hooks to dynamically incorporate a new className

Can someone help me understand how to change the styling of my hamburger icon when it's clicked? I'm trying to add a new className to it using hooks and then target that class in Sass. The className is being added correctly, but the new styles ar ...

Adjust the size of the logo picture

Hey there, I have a question that may seem a bit silly, but I'm just starting out with coding. I'm trying to resize and center my logo image (which is currently taking up the whole page in preview), but no matter what I try with CSS, nothing see ...

Capture the blur and click events when selecting an <input> field

When following other questions on StackOverflow to capture blur and click events, I encountered the error message: e is not defined HTML: <input type="text" name="mpsRegnomer" er="невалиден номер" id="mpsRegnomer" class="upertrim inpu ...

What is the best way to align two buttons horizontally together?

I've created an HTML form using JavaScript, but I'm facing an issue where the cancel and submit buttons are displayed on separate lines. How can I align them horizontally? Here is the code snippet I'm currently working with: var new_commen ...

Using jQuery's .each() method to gather text inside list items

When using jQuery and AJAX to submit a form, my PHP file handles validation and returns either a success message or a list of errors. If the submission is successful, the response would be: <div id='formres'>1</div> <div id=&apos ...

Issue with React Bootstrap Scrollspy not functioning correctly on Android mobile browsers

I am currently using bootstrap 5.2.2 within React to add Scrollspy functionality to my menu. The Scrollspy feature functions correctly in web browsers on laptops and iPhones. However, on Android mobile devices, the Scrollspy fails to update the active lin ...

Auto Height Background Colour in Dual Columns

There seems to be a simple issue that I'm missing here. I have two columns that maintain the same height based on the content inside them, but the background color doesn't fully extend in the shorter column. When the display shrinks, the columns ...

Dynamic navigation - main menu featuring a hyperlink

I am facing a scenario where I need to redirect the parent menu to a link instead of displaying the sub-menu. Currently, I am using Slick Menu http://slicknav.com/ It makes sense that the parent menu should not be linked to show the child menu on mobile d ...

Update the Django translation file with new modifications

Currently, I am in the process of developing a web application using Django and have recently integrated Django allauth to streamline the creation of my user interface. I have successfully customized the templates by incorporating the templates from their ...

Divide table rows in html without a header into two equal parts, with 50% on the left side

I am trying to format 20 rows in a standard html table without any headers. The current setup looks like this: current situation <table> <tbody> <tr> <td>1</td> </tr> <tr> ...

Adjusting the Stripe Button to Utilize a Unique Button Class

I have a stripe button on my website and I want to add my custom class to it. I discovered that manually creating the CSS for it can work, but I prefer to maintain consistency across all buttons on my site by using my custom class. No matter what I attemp ...