This usage guide will give explanation about creating and using CSS Styles in the HTML.
- CSS files can be created using simple text editors or professional code editors.
- For creating a CSS file, First open the new file in the your preferred editor.
- Write CSS styles with selector and properties. Which you can find in further topics.
- Then save it as
filename.css
withUTF-8
encoding. - When it comes to editing an existing CSS file, Then open the file in the editor to make changes. Finally save to apply styles to the HTML elements.
- Once CSS file is created then it can be link to the existing HTML document.
- Refer Link Tag and Use it for linking the CSS files to the HTML document.
- Save the HTML document to apply changes.
- Then
select the html file
and run by hitting theENTER
button - Or by
open
or byopen with
option menu associated with that selected file. - After that above actions will be reflected on the HTML document.
- Instead of CSS files, You can directly write styles for the HTML document via Style Tag or via
style=""
attribute of the each element. - The best practice is, Write separate file for CSS Styles to make HTML document clean and neat in the code. And also it gives the code re-usability.