0% found this document useful (0 votes)
8 views8 pages

Introduction To CSS

Uploaded by

sreeemathii
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views8 pages

Introduction To CSS

Uploaded by

sreeemathii
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Introduction to CSS

CSS is a powerful language for styling web pages. It allows you to control
how elements are presented visually, including their colors, fonts, layout,
and more.

by srimathi
Selectors

1 Element Selectors 2 Class Selectors


Target elements based on Apply styles to elements with
their HTML tag names, such specific class attributes, like
as <p> or <h1>. "intro" or "highlight".

3 ID Selectors 4 Attribute Selectors


Target elements with unique Select elements based on
ID attributes, providing their attributes, including the
precise control over attribute name and its value.
individual elements.
Properties and Values
Color Font Layout

Set the background color, text color, Control the font family (e.g., Arial, Position elements using margin,
and more using color names (e.g., red, Times New Roman), font size, font padding, width, height, and display
blue), hex codes (#FF0000), RGB style (normal, italic), and font weight properties to create flexible layouts.
values, or HSL values. (bold, light).
Cascading and Inheritance
Cascading
1 CSS rules are applied in a specific order, with later rules
potentially overriding earlier ones.

Specificity
2 CSS rules with higher specificity (e.g., ID selectors) take
precedence over less specific rules (e.g., element selectors).

Inheritance
3 Child elements inherit certain properties from their parent
elements, such as font styles and color.
Box Model
Content Padding
The actual content of the Space between the content and
element, including text, images, the border, creating internal
or other elements. padding around the content.

Border Margin
A visual line around the Space between the element's
element, defining its border and its neighboring
boundaries, can be styled with elements, controlling the
width, color, and style. spacing around the box.
Layout with CSS
Flexbox Flexible layout system for
aligning and distributing
elements along a single axis,
perfect for responsive designs.

Grid Powerful layout system for


creating complex layouts by
dividing a page into rows and
columns, offering precise
control.

Position Control element positioning with


static, relative, absolute, and
fixed positioning properties.

Float Allows elements to flow


alongside one another,
wrapping around content on
either side, creating dynamic
layouts.
Responsive Design
1 Media Queries
Apply styles based on screen size, device orientation,
resolution, and more, allowing for dynamic adjustments.

2 Viewport Meta Tag


Controls how the website is displayed on mobile devices,
ensuring optimal responsiveness and scaling.

3 Flexible Layouts
Use flexible units like percentages and relative units (em,
rem) to ensure elements scale smoothly across different
screen sizes.
Best Practices and Resources

Documentation Code Examples


Refer to official CSS documentation Explore code examples and
for detailed information on tutorials to learn best practices and
properties, values, and syntax. common CSS techniques.

Online Communities Developer Tools


Connect with other developers in Utilize browser developer tools to
forums and online communities to inspect CSS styles, debug issues,
ask questions, share knowledge, and experiment with changes.
and stay updated.

You might also like