CSS Introduction
- CSS is the acronym of “Cascading Style Sheets”. CSS is a computer language for laying out and structuring web pages (HTML or XML). This language contains coding elements and is composed of these “cascading style sheets” which are equally called CSS files.
- It allows users to define how HTML content is displayed, making it easier to format and style web pages.
- CSS can manage various aspects of a webpage, such as text color, font styles, and paragraph spacing, among other things.
- While CSS is straightforward to learn, it offers powerful control over HTML documents.
Who Is The Father Of CSS?
Hakon wium lie is know as father of CSS. CSS was proposed in 1994 as a web
styling language, to solve some of the problems of Html 4.
What is CSS?
CSS stands for Cascading Style Sheets. CSS is utilized to style HTML elements. CSS is a commonly used language for web design. Together with HTML and JavaScript, CSS enables web designers to apply visual styles to HTML tags.
Selectors:
Target HTML elements to apply styles. For example, p { color: red; } changes all paragraph text to red.
Box Model:
Elements have margins, borders, padding, and content areas. Adjust these with properties like margin, border, padding.
Colors and Fonts:
Use color for text and background-color for backgrounds. Define fonts with font-family, font-size.
Layout:
Use properties like display, position, flex, and grid to arrange elements.
Responsive Design:
Use media queries like @media (max-width: 600px) { ... } to adapt styles for different screen sizes.
Program:
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: white;
background-color: red;
padding: 5px;
}
p {
color: blue;
}
</style>
</head>
<body>
<h1>Hello Friends</h1>
<p>This is a paragraph.</p>
<body>
</html>
Output:
Why Do We Use CSS?
CSS is a powerful language used to style and control the design of HTML
documents, enhancing the appearance of webpages.
Program:
Three Types Of CSS:
- Inline CSS
- Internal CSS
- External CSS
Main Concepts Of CSS:
There are three main parts of CSS - selectors, properties, and
values.
CSS Latest Version:
CSS3 is the most recent and currently used. It has XHTML
specification.
Program:
<html>
<body>
<p
style="color: #616aeb; font-size: 50px;
font-style: italic;
text-align: center;">Gocourse</p>
</body>
</html>