How to override w3.css for table border


Tags: css

Problem :

I have a page where I need to display borders within a table and I'm using w3.css, this has the following:

table,th,td{border:none}

I have my own css file and have tried:

table,th,td{border:1  !important}

With and without "!important", after doing some searches I have also tried:

$("table").removeAttr('style').css("border","1");
$("th").removeAttr('style').css("border","1");
$("td").removeAttr('style').css("border","1");

I have tried the above with .table, .th, .td and have tried "1px" too.

I know that I can change the w3.css by removing the border settings and it works just fine, however, I would prefer not to do that.

TIA

Regards, Peter



Solution :

border is a shorthand property for border-type, border-width, and border-color. You need all three properties.

table {
    border: 1px solid #000;
}

    CSS Howto..

    How to prevent css loaded with query being applied to whole page?

    Twitter Bootstrap - how to add some more margin between tooltip popup and element

    Links fade in when hovered - how to get them to stay opaque when their target is visible?

    How to design WPF in HTML, CSS and JavaScript

    How to make a header that changes position (like Pinterest)

    How to fit a dynamic PHP form in a div (to be able to fit fullpage.js)?

    How to create centered image slideshow behind website content

    How to exclude CSS file from Visual Studio intellisense?

    how to stop CSS hyphenation, no dash between words

    How to put borders closer to the text and image and make background gray in CSS?

    How do I change the color of Semantic UI icons?

    HTML/CSS: How to resize checkboxes (without overlapping)

    How can I allign select menu with a button on the same line with css bootstrap?

    How to inline style an embedded gist with CSS

    How do I keep an element from pushing another element in CSS?

    How can I use :nth-child() to select every other
    within ALL children?

    how to pass context value to css

    How to apply a sifr rule to a hyperlink and also its a.active counterpart

    How to play a second CSS animation once the first one finishes

    How to apply gradient color in css?

    How do I get a div that appears on hover to overlap all others, without using absolute positioning?

    How to slow down the last few frames in a CSS sprite animation?

    How to inject a css class into an MvcHtmlString?

    How can i make a site like this by myself? [closed]

    How to set angular json model into css

    How to monitor what the user clicks

    How to replicate the styling of html heading tags

    HTML and CSS: How to lay out a div tag with width:100% and left:300px

    How can I make clickable list with sublinks ?

    How to set the height with css to 100% and make it fluid?