Why we use css , when we can styling tho by html ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why we use css , when we can styling tho by html ?

..

3rd Mar 2018, 10:51 PM
Youssif Almassri
Youssif Almassri - avatar
4 Answers
+ 6
It is inefficient to have everything in a file. Let's assume that you are creating a web page that consists of 8 sections (each section is a new document) and, obviously, those sections will have many details in common (the font, color scheme, badges, background images, etc.) Would you write the same code 8 times? Even in the best of cases that is highly inefficient, and if in the future you want to make a change it will be problematic. That is why you divide your files, in order to make them reusable among the entire structure. Normally if you make a change you just need to define it in one place and it will be visible everywhere, and that is very practical. On the other hand, even if you put it embedded in HTML that is still CSS. You could use another style language, but it's not such a common practice and probably (if you're working as a team) that generates problems (apart from browser compatibility).
3rd Mar 2018, 11:51 PM
Mickel
Mickel - avatar
+ 14
CSS can provide more efficient styling and more options as well sometimes 😊 And as @Mickel said, it's inefficient to have everything in one place. With CSS you can make your codes more efficient and they can stay beautiful 🎨😊😄
4th Mar 2018, 3:30 AM
Learnsolo
+ 3
No we can't styling using html, css is very useful for that. If you you make a tag : <div style='color:blue' ></div>, you use css in the style parameter
3rd Mar 2018, 10:56 PM
Αητοιπe
Αητοιπe - avatar
+ 1
Although you can set the style of an element directly this is inefficient and leads to clutter that is hard to manage. CSS, cascading style sheets allow you to use different targeting parameters and group all styling data into one organized place.
3rd Mar 2018, 11:09 PM
Lewis
Lewis - avatar