This forum is now read-only. Please use our new forums! Go to forums
Why use CSS and not just the html code we used before
why do you use css sheet when before we were just putting that code directly in with the html stuff, like
why do you choose one way over the other?
Answer 51357cf5bd57db5338000e35
Inline styling (<p style="color: green;"></p>
) can bloat out your code and are a nightmare to update if you have a lot of them.
External stylesheets (stylesheet.css
) allow you to completely separate your CSS from your HTML everything is stored within a single file and once changed/updated, the changes are reflected on all other pages that reference the stylesheet.
This makes it easier to maintain larger websites and helps load pages quicker once the main CSS file has been cached and as a result bandwidth goes down.
effectively, you’re able to change the entire look and feel of a website through a single file.
The internal stylesheet (<style></style>
) is placed within a page’s head tag and is intended to only modify the style of the page that includes it.
It’s basically the mid point between the external and the inline styles. Like the inline the internal stylesheet is good when you need to make changes to a single document. Another good time to use this is when you only have to create one standalone page.There’s no point in making a new css file for one page.
Hope that helps
Answer 544c2c2d80ff33cc85000172
It’s better to have a separate css file for maintenace. If you have 2 or 3 pages you can use inside css (with style), but if you work on a real website, let’s say about 100 pages, how do you do that job in 1 hour?. Answer adding a separate css file.
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
2 comments
taaank you!
taaank you!