Suresh Atta
Suresh Atta

Reputation: 122008

Default CSS ovveriden the styles applied in HTML

Firefox screenshot

Here, I am facing another problem with CSS.

My HTML string is coming from database and adding to DOM with HTML Object.

new HTML(result.getResponseObject().getStringResult());

That string contains some HTML tables and have border="1", that has been overridden by default CSS (you can see that in Firebug), where as the border applied in HTML like border="1"

How to tell that the applied styles are in HTML, not from any CSS file (or did I miss something in my code)?

I tried with 1px solid !important; it's still not working.

Upvotes: 0

Views: 82

Answers (2)

user2310967
user2310967

Reputation: 283

Why are you using the border attributed to begin with? In HTML5, it's meant only to indicate that <table> is being used to draw an actual table, rather than just for layout. If you want to specify a table border, you should use something like 3rror404's solution (although I would explicitly use table[border="1"] as the selector to avoid problems if you also have tables with border="0" anywhere in the document.

Upvotes: 0

Turnip
Turnip

Reputation: 36672

If I understand your question correctly you could do something like this:

table[border] {
    border: 1px solid black;
}

This will select any table that has a html border property eg:

<table border="1">

but will ignore those that don't

Here's a demo

Upvotes: 1

Related Questions