CSS tables are not properly recognizing the class values within the table

This is the CSS I am working with:

table {
margin: 10px 0 20px 0;
width: 100%;
text-align: center;
}   

table th {
color: #38A4FC;
padding-top: 5px;
background-color: #f9f9f9;
width: 200px;
height: 30px;
border: 1px solid #d7d7d7;
border-bottom: none;
}

table td {
background-color: #fff;
height: 35px;
border: 1px solid #d7d7d7;
padding: 10px;
}

table tr:hover td {
background-color: #eee;
}

In addition to this, I have another set of classes for a different table:

.web_table
{
width:90%;
border:0px solid;
}

.web_table_td_left
{
width:50%;
height:30px;
font-family:Arial;
font-size:15px;
color:#000000;
}


.web_table_td_right
{
width:50%;
height:30px;
font-family:Arial;
font-size:15px;
color:#000000;
text-align:center;
}

However, when I apply these classes to a table like this:

<table class="web_table"><tr><td class="web_table_tf_left"></td><td class="web_table_tf_right"></td></tr></table>

The table ends up using the properties from the general "table" CSS rather than the specific class styles. I'm not sure what's going wrong here, it seems like when one class is applied, it should override the others. Any insights would be appreciated.

Answer №1

I often ponder about the amount of productivity wasted due to typos. I believe I've lost a significant chunk of time because of them. :)

It appears that your CSS is targeting elements with the class .web_table_td_right, but in your HTML, the classes are named web_table_tf_right. The difference between td and tf.

http://jsfiddle.net/MRrYs/

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

Ways to style the bottom border of an input with CSS

Currently, I am trying to change the color of an input border bottom when the input is not in focus. Below is my HTML code: <input type="number" id="nc" name="days" class="numero" placeholder="" min="0"><br /> Here is the CSS code I have trie ...

Interacting with mouse events on every <g> element within an SVG file integrated into the three.js material

I am currently loading SVG images onto the mesh basic material of a BoxBufferGeometry(cube) using SVGLoader. My goal is to trigger mouse events when a user hovers or clicks on a specific element of the SVG which is loaded on a particular side of the cube. ...

Creating a CSS3 Grid Layout with a Fixed Header

I'm having some trouble creating a layout using CSS Grid. My goal is to make the header element 'sticky', so that it remains fixed at the top of the viewport while other content scrolls up and underneath it. Additionally, I want to add a bac ...

What is the difference between using min-height in vh versus % for the body tag

I'm trying to understand a code where the min-height of the body element is set to 100vh after previously defining the height of the html element as 100%. Why is there a need for this specific sequence? body { position: relative; overflow: hidd ...

Tips for aligning a title to the bottom when its length varies

I am facing a design challenge where I need to align a header with content in a different column. The header's length can vary, so I need to figure out how to align the border-bottom consistently. (The code snippet below is just for illustration pur ...

What causes a 404 error when a GET response is returned in a Node.js server?

Having some issues with my server setup. I have a server.js file running on node js. When I try to access the CSS and JS files linked in my index.html, I keep getting 404 errors even though the files are present in the specified path. I suspect there might ...

Is there a way to keep my fixed button at a consistent size while zooming on mobile devices?

There are no definitive answers to the questions regarding this issue. Some suggest stopping zoom altogether, while others recommend setting the width, which may not always solve the problem. I am working on a web application designed for mobile use with ...

"Get rid of the arrow in Bootstrap's dropdown menu

I'm currently using a bootstrap template that features an accordion menu. However, I have come across a scenario on one section of the page where I do not require the items to expand and show additional text, therefore, I would like to remove the arro ...

Sending selected option from bootstrap dropdown to the subsequent php page

Is there a way to pass the selected value from a dropdown in Bootstrap to the next page? I have multiple options to choose from and I don't want to create separate pages with the same layout for each option. How can I pass the dropdown value to the ne ...

Is there a way to determine the orientation of an image in React-Native, whether it is horizontal or vertical

When working with react-native, I aim to utilize the 'contain' feature for vertical images and the 'stretch' feature for horizontal images. What would be the best way to determine the orientation of an image as either horizontal or vert ...

Ways to automatically insert an icon within a textarea

While attempting to insert an image inside a textarea, I discovered that it seems impossible without using the contenteditable ="true" attribute of a textarea. However, upon visiting the diaspora site, I found out that this can indeed be achieved. I am uns ...

Internet Explorer fails to execute CSS or jQuery commands

Apologies in advance for posing a question that may not be specific or beneficial to the wider community. Currently, my main focus is resolving this issue for my own peace of mind. In the process of designing a website, I implemented a social drawer featu ...

difference in flex-shrink behavior between Firefox and Chrome

Why does this code sample render differently on Firefox than on Chrome? Is this a browser bug, and if so, which browser is rendering per spec? If there is a bug report available, I would appreciate a link to it. Currently, adding flex-shrink: 0 to the na ...

The concept of CSS div wrapping and managing vertical whitespace in web design

My goal is to make multiple div elements wrap to the next line when the width of their container is changed. The wrapping part is working fine, as the boxes drop to the next line when there isn't enough width for them to fit. However, I am facing an i ...

What is causing the collapsed-animation to malfunction in Vue3?

Why won't the transition animation function in vue3js? The animation does not appear to be working for me. I've implemented this library https://github.com/ivanvermeyen/vue-collapse-transition <template> <nav class="navbar color-d ...

Interactive Vue.js canvases that adapt and respond to various

I am currently working on adjusting my canvas to fit within its container in a Vue component. When I call resizeCanvas() in the mounted hook, I notice that the container's height and width are both 0. How can I create a canvas that dynamically fits it ...

Sending information to the styles feature in Angular 2

Is there a way to transfer data from an Angular tag to the styles in the @Component? Take a look at my component: import { Component, Input } from '@angular/core'; @Component({ selector: 'icon', template: `<svg class="icon"> ...

Is there a way to undo the CSS rotate animation that has been applied?

Struggling with reversing a CSS animation based on a class being added to a DOM node? Take a look at the code I've been using: EXAMPLE // Closed state @-moz-keyframes spin-close { 100% { -moz-transform: rotate(-0deg); } } @-webkit-keyfra ...

What is the best way to customize the appearance of an Angular tree component?

I'm attempting to incorporate the style of the ACE Admin theme into the angular-tree-component. Currently, my tree looks like this: https://i.sstatic.net/ktiEf.png However, I desire to apply styles from the Angular tree guide in order to achieve a ...

Changing CSS attributes with jQuery when conditions are met

After creating menus with expandable items that change style upon clicking, I encountered an issue where the styling changes were not being applied correctly. To address this problem, I followed Sushanth's suggestion and replaced $this with $(this), ...