/    Sign up×
Community /Pin to ProfileBookmark

Do CSS styles properties ALWAYS take priority over html attributes?

For example… if there were an html table with a border defined, as in…

[code=html]
<table class=’myTable1″ border=”1″ width=”90%” align=”left”>

[/code]

and in the html document’s head area a CSS border were defined

[code=html]
<!–
<style>
.mytable1 {border: 2px; }
width: 80%;
margin-left: auto;
margin-right: auto;
</style>
–>
[/code]

Note that I’ve intentionally made the html attributes be in conflict with the CSS, because I want to know what takes priority, and whether this is ALWAYS the case. So in the above, can I safely assume that in any modern browser the table border using that class will always be 2px wide and centered? Also, are there exceptions where an html attribute will take priority over a CSS property?

I realize I can try this for myself, but i can’t really because I don’t have every browser out there. I’m writing because I’ll be updating a very old site which may be visited by elderly and other’s on fixed incomes, whose computers and browsers may be ancient.. I realize there is a limit to this, but I’d like to make sure formatting is at least reasonable in as many cases as possible, while still making use of all the great added features CSS has to offer.

to post a comment

2 Comments(s)

Copy linkTweet thisAlerts:
@rootDec 24.2018 — CSS changes elements as they are encountered.

So the rule you set can be overwritten by inline code, other CSS being applied to the elements...


Copy linkTweet thisAlerts:
@HarshatecordeonDec 24.2018 — Checkout this

https://www.plus2net.com/html_tutorial/css-types.php

https://tecordeon.com/
×

Success!

Help @PeterPan_321 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...