What is CSS ?
Next ❯CSS Syntax
- Stands for Cascading Style Sheet
- Used to design Web Pages
- Easy to control the layout/design of multiple web pages all at once
- Easy to update layout, simply change the css, all the web pages will be updated automatically
- File Extension: .css, When file only contains CSS script
Example:
Write Your First CSS Script!
Below, only one way is shown to write and run CSS in your HTML Web Page, more will come in coming section
Steps:
- turned_in_notOpen Your Text Editor
- Here, we are using Notepad as a text editor and Windows as an operating System
- Option 1: Desktop Screen->Right Click->New->Select Text Document
- Option 2: Start button->Search Notepad
- Option 3: Press Windows Button + R -> Type Notepad-> Press Enter
- You can try any of the above option, And for other text editors you just open the editor
- mode_editWrite your CSS script
- You can write or copy the script in your text editor
body { line-height: 24px; font-family: "Roboto", sans-serif; font-weight: normal; font-size: small; background-color: #9479dd; color: rgba(0,0,0,0.87); }
- descriptionSave the file
- You save the file With extension .css
- mode_editInsert CSS file in HTML page
- Below CSS file name used is myCssFile.css
<!DOCTYPE html> <html> <head> <title>My First HTML Page with CSS</title> <!--CSS File Inserted syntax--> <link href="myCssFile.css" type="text/css" rel="stylesheet"> </head> <body> <h1>My First Heading</h1> <p>My First paragraph.</p> </body> </html>
- doneRun your Updated HTML file in the browser
- Here both the HTML & CSS File are in the same folder
- Open the saved file in your browser!
- Bingo! you have just write and run your First CSS file with HTML
❮ Prev Getting Started
Next ❯CSS Syntax