Is the CSS element selector more specific than the HTML attributes?

So here is a simple test case

What I'm trying is that if we use attributes for style elements (I know this is a very bad idea, but I did it for experiments)

So the question is, are CSS selector selector styles more specific than HTML attributes?

View CSS - 1 / HTML - 0 <!-- Specificity -->

If CSS not used, HTML - 1 <!-- Specificity -->

HTML test case

<table border="1">
    <tr>
        <td>Hello 1</td>
        <td>Hello 2</td>
        <td>Hello 3</td>
    </tr>
</table>

CSS

table, table td {
    border: 0;
}

So, general CSS is specific than HTML for styling? Or we can override CSS with attributes other than attribute style.

+5
source share
1 answer

From the CSS 2.1 specification :

UA HTML. , CSS , 0, , . . .

CSS 3


, CSS , HTML ?

. HTML . CSS.

-, CSS , style

. style - CSS . ( JavaScript DOM, style.)

+8

All Articles