FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

The preference in CSS...

 


kk_loke86
My lecturer have taught me about three type of CSS can be inserted into HTML pages.

The first one is the inline insertion using STYLE.

The second one is the embeded CSS which putting the STYLE at the HEAD part of HTML.

The third one, possible the most being be used one is the external CSS, which refers all the code for STYLE from an external file.

The question is if this three are used in one HTML page, which one is the first one to refer? I try inline CSS but it just don`t work when external CSS is attached on the page. Can anyone explain this to me? Thanks.
Emmer-Compascuum
Inline styles have the highest priority, followed by the <style>-style stylesheet. The external stylesheet has got the lowest priority.
imagefree
Emmer-Compascuum wrote:
Inline styles have the highest priority, followed by the <style>-style stylesheet. The external stylesheet has got the lowest priority.

i think the sequance also matters. Sequance mean the sequance of style's appearing in the code provided that two styles are affecting the same thing. Its good because its just like programming languages work, but sometimes its just a headace.
snowboardalliance
imagefree wrote:
Emmer-Compascuum wrote:
Inline styles have the highest priority, followed by the <style>-style stylesheet. The external stylesheet has got the lowest priority.

i think the sequance also matters. Sequance mean the sequance of style's appearing in the code provided that two styles are affecting the same thing. Its good because its just like programming languages work, but sometimes its just a headace.


Yes generally the second time something is in CSS, it will override old settings, unless you use the !important flag.
D'Artagnan
i think it depends on your page,

if you're doing css just to change the border on a table you can use inline css *...

but if you're doing a full tableless layout and scripting your site i think the best option will be using external stylesheets or html style tags.

i use to work with external stylesheets add throught link tag, because i have all my styles centralized (that's the word?)
in only one place, so i dont need to dig into a dozen files to change the color of my links(<a>) for sample...

you can achieve the same effect with the style tag, but you'll need to place it file by file, or (uing some creativity) place a include/require with the style tag, wich i think is unecessary since html already have the link tags.

most big portals that follow the standarts (at least in part), use the link to the style sheet/s and use <style> tags only in very specific situations...

*be aware that if you use to make xhtml standard pages inline css is "against the standard"....
AOP Web Development
The highest priority is the INLINE,next is the HEAD styles lastly is the external CSS
Azmo
Don't mix CSS inline with extern stylesheets, keep it simple, keep it all in an extern stylesheet imo!
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.