DEV Community

Guna Ramesh
Guna Ramesh

Posted on

CSS-Cascading Style Sheet

1.What is CSS and Why we use this?
CSS is used to style the html tags.
Like:
Color
Background Color
Size
Border etc...
Because html is a tag if we enter the value inside any tag its will display in browser. But its look normal,ok now i ask one question we see two sites one is display in black and white without style and other is look color-fully and use more styles.
I think all are like the second one right!
That's why we using CSS.
2.How many ways to using CSS?
we must know

1.Inline CSS
2.Internal CSS
3.External CSS
Inline-Inline CSS is applied directly inside an HTML element using the style attribute.
<p style="color: red;">Hello World</p>
Use one element only
can't reusable.
Internal-Internal CSS is written inside the <style> tag in the <head> section of an HTML page.
<head>
<style>
p {
color: blue;
}
</style>
</head>
Works for single page
Easy to manage inside same file
External-External CSS is written in a separate .css file and linked to HTML.
These is the format to link CSS file to Html file.
<link rel="stylesheet" href="style.css">
We go clearly from basics of css.
1.create a one div class fix any name to that div.
1.i am using the name is container.
2.Container is created but cant visible.
3.Use css to make color and set width and height.
how to use
div class name is container
.container{
border:1px solid green; //now border is visible like green color.
height:100vh;//why we did a height 100vh -view of height 100 fully covered. But dont need to set width because div tag is block level so take full width.
}

Without CSS Property

Border 2px solid green

Border 2px solid
100vh

Upcoming days i will update next properties.

Top comments (0)