The table does not recognize any of the CSS classes when the TAG is inputted inside

I am currently working on a challenging form for players to save their personal character sheets in a database. To achieve this, I am incorporating numerous Input TAGs and utilizing tables for layout purposes, ensuring an organized and efficient design.

Each input is assigned specific classes that adjust their height, width, and text-align.

HTML

<div id="a_ability" class="advanced">
  <h3>Advanced</h3>
    <table id="tab02" width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th scope="col">Ability</th>
        <th scope="col">Temp Value</th>
        <th id="tab02" scope="col">Bonus</th>
        <th scope="col">Magic Obj</th>
      </tr>
      <tr>
        <td>Strenght</td>
        <td><input type="text" name="temp_str" class="50x50"></td>
        <td><input type="text" name="bonus_str" class="50x50"></td>
        <td><input type="text" name="mag_str" class="50x200"></td>
       </tr>
       <tr>
         <td>Dexterity</td>
         <td><input type="text" name="temp_dex" class="50x50"></td>
         <td><input type="text" name="bonus_dex" class="50x50"></td>
         <td><input type="text" name="mag_dex" class="50x200"></td>
        </tr>
   </table>
 </div>

CSS

.50x50 {
height: 50px;
width: 50px;
text-align: center;
}
.50x200{
height: 50px;
width: 190px;
text-align: left;
padding-left: 10px;
}

Despite setting the classes, they seem to have minimal effect on the input tags. The dimensions default and applying IDs individually would become a laborious task. Some CSS rules only work with the !important declaration or not at all.

While using Dreamweaver in "Design view", everything appears well until switching it on, causing discrepancies in input format.

Things I've verified:

  • No observable css conflicts affecting styles
  • Inspecting through Chrome unveiled unknown widths applied to inputs

Could these anomalies be linked to user agent stylesheets? Evident from instances where Chrome yields unexpected values.

width: 84px;
   .advanced table tr td - 50px

The mystery of the 84px persists without any identifiable rule attributing it. How could this issue be resolved?

More information added:

To witness the faulty stylings firsthand, access JSFiddle here. What corrective measures can be implemented?

Answer №1

Avoid using class or id names that start with numbers.

Check out this fiddle with an additional i (the specific letter doesn't matter)
http://jsfiddle.net/Sr9Vx/1/

Edit:
I noticed the link provided by @Trey in his comment (Which characters are valid in CSS class names/selectors?) where you can find explanations and official references.

For example:
http://www.w3.org/TR/2003/WD-css3-syntax-20030813/#characters
http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier

Best of luck with your project.

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

Angular: Design dependent on attributes

Can I customize the styling of a div in accordance with a boolean property called "isActive" on my controller using Angular? <div class="col-md-3" (click)="isActive = !isActive"> <div class="center"> <i class="fa fa-calendar"& ...

How to align an element in the center using flexbox while considering the width of the display rather than the available

I need help centering an element that is 100px in width on the display. On either side of this element, there are elements that are 300px and 200px wide. I tried using flexbox to achieve this, but I ended up with two empty spaces or flexible-width element ...

Tips for avoiding the transmission of className and style attributes to React components

Hey there! I'm working on a custom button component that needs to accept all ButtonHTMLAttributes except for className and style to avoid any conflicts with styling. I'm using TypeScript with React, but I've run into some issues trying to ac ...

Offspring of the superior element resting above another element

I'm dealing with a unique situation involving the Z-INDEX property. Check out my HTML setup below. <div class="player"> <div class="player-line"> <div class="player-handle"></div> <!-- /.player-handle --> </d ...

Struggling with getting Bootstrap Affix-bottom to scroll back up?

Despite reading various answers, I am still struggling to configure the settings correctly. The columns header is not resuming scrolling upwards as expected. Below is my PHP code snippet: <div id="columnsHeader" class="affix" data-offset-top="800" da ...

Scrollbar Overlay

I am currently working on an HTML page where I have implemented a CSS style overlay lightbox effect using CSS and jQuery. If you want to take a look at the code, click here One issue I am facing is that when I resize the window height so the right-hand s ...

Align the subtext to the right and center it vertically within a Bootstrap dropdown menu item

Is there a way to vertically align small captions on the right side of a dropdown menu, next to each item's text? The issue is that in the example below, the numbers are not properly aligned. https://i.stack.imgur.com/NZigW.png The numbers 123 and 1 ...

Tips for integrating a "datetime" picker in your AngularJS application

Currently working on an AngularJS application. The single page has a date input that needs to be added. Date Input <input type="date" ng-model="InputDate" /> Any suggestions on how to accomplish this task? ...

Button for browsing weekly recipes in HTML table format

Seeking assistance in creating a dynamic weekly recipe webpage using HTML and CSS. The goal is to have a form where users can submit a recipe, which will then be added to a specific day of the week in a table displaying all recipes for that day. Can someon ...

Using the class for jQuery validation as opposed to the name attribute

I am looking to implement form validation using the jquery validate plugin, but I am facing an issue with using the 'name' attribute in the html since it is also used by the server application. Specifically, I want to restrict the number of check ...

Tips for inserting PHP information into the <link rel="stylesheet" type="text/css" href="CSS/sheet.css" /> reference tag

In my script, I have successfully implemented a feature that displays the OS and browser details. The output is in the form of eight CSS scripts, showcasing Mac, PC, and Ubuntu OS's with IE, Firefox, Safari, and Chrome browsers. While the script is st ...

Bootstrap 5 introduces an innovative animated hamburger icon that transforms into an X symbol when clicked

I have encountered an unusual behavior when trying to animate the hamburger button using Bootstrap 5. Previously, with Bootstrap 4, everything worked smoothly. However, in Bootstrap 5, I noticed that the icon initially displays as 'X' and then sw ...

How can I search for a particular string in JavaScript?

I have a unique custom div that has been modified to function as an input element. Inside this custom div input element, there is a <p> tag with a default placeholder text. My goal is to verify whether the content of this div is empty or contains new ...

Can you please tell me the CSS pseudo element that corresponds to the AM/PM field in an <input type="time">

The issue with the am/pm display is dependent on the browser that the app is opened in. I am looking for a universal solution to ensure it does not appear in any popular browsers. Below is the HTML code for my input time field: <input type="time" for ...

Is it possible to utilize the Wicket:id for generating CSS?

Can the wicket:id attribute of an element or component be used for CSS styling instead of the "class" attribute? For example: .tooltipster-arrow span, .column-shifter { display: block; width: 0; height: 0; position: absolute; } Let&apos ...

When the window size is reduced, the image continues into the next div

I need to create a page that displays text alongside an image. However, when the window size is minimized, the image overlaps with the text. Here is how it looks: https://i.sstatic.net/CBMh8.png To fix this issue, I am using the following HTML code: ...

The dropdown feature within a bootstrap button group is malfunctioning

As part of the web track in cs50, I am working on creating a webpage. My goal is to include options for navigating to the next or previous pages, as well as a dropdown menu with all the pages in between. However, when using Bootstrap's code, the dropd ...

The Bootstrap row does not display divs in a stacked formation when viewed on smaller screens

My layout is using bootstrap rows for two divs. I want them to be side by side on large devices, but stacked on small devices. However, Bootstrap is not stacking them on small devices and they are still both sitting at 50%. The specific divs I am talking ...

Do you know where I can locate the HTML and CSS pertaining to the search results page

I'm looking for a way to present search results on my website that resembles the Google search results, creating a familiar interface for users. Is there anyone who knows where I can obtain the HTML and CSS code that produces the same style as Google& ...

What is the best way to add a centered progress spinner on top of an overlay?

Here is a code snippet that includes functionality to append a site overlay as needed. I am currently trying to implement the feature of also displaying an image progress spinner in the center of the screen over the overlay. I would prefer if this spinner ...