+ 1
Is it recommended to use CSS if I can use HTML insted?
to be more clear ... there is some HTML propertys like text-font that I can set it just by using this line of code text-font="bold" but by using CSS i need to create CSS file and then set an id to the text"for example" and then writing some CSS stuff ... so my question is.. if there is ability to set those propertys by using HTML code ..why some programers use CSS for this trivial stuff ? and if it's recomended tell me why?
5 Respuestas
+ 6
If it's a one-off case (a tag or two with a style used nowhere else on the site), it may just be simpler to use inline CSS. But if the style is used on multiple pages and/or various tags, the CSS should be written in a separate file and applied with classes and IDs.
+ 4
Working on a bigger project, CSS helps you keep your code more organized and easily maintained. CSS gives you the ability to not write the same code over and over again (bad practice). Changing stuff later is easier working with CSS then trying to find it everywhere in your HTML files. On that note, there are also CSS pre-processors like SASS, that give you even more control and power when working with CSS. So, yea... CSS is the the way to go, there are just too many benefits that i haven't mentioned, i haven't even scratch the surface of "why it's better to use CSS than HTML styling", but trust me, CSS is the right choice!
Hope I helped! :)
+ 4
Depends, if CSS gives better results, use CSS. Else you can just code some design stuff in HTML.
+ 3
you use CSS as a powerful tool to edit your codes design in the browser. example would be, you had over 200 lines of code and you want all your <p> tag to be 14px, in css you can easily add 1 line of code and ot applies it to all your 70 <p> tags, so now you dont have to add style on every 70 p-tag;) hope it answer your questipn abit.
+ 3
Anyway, Html5 specifications deprecate most of inlined attribut. Even 'style' attribute is discouraged, and to reserve for javascript access and/or draft steps, if you want a valid Html5 doctype ^^