Skip to content

Commit 9cf4e35

Browse files
authored
Merge pull request #314 from AmrutaJayanti/main
Added CSS in docs
2 parents 358a9ba + 29ce6aa commit 9cf4e35

File tree

4 files changed

+189
-0
lines changed

4 files changed

+189
-0
lines changed

docs/CSS/css-basics/Selectors.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# CSS Selectors
2+
3+
CSS selectors are patterns used to select and style HTML elements. Selectors target specific elements based on their type, class, ID, attributes, or position in the document. Here are some common types of CSS selectors:
4+
5+
## 1. Element Selector
6+
7+
Selects HTML elements based on their element type.
8+
9+
Example:
10+
```css
11+
p {
12+
color: blue;
13+
}
14+
```
15+
This will select all `<p>` elements and make their text blue.
16+
## 2. Class Selector
17+
18+
Selects elements with a specific class attribute.
19+
20+
Example:
21+
```css
22+
.my-class {
23+
font-weight: bold;
24+
}
25+
```
26+
This will select all elements with `class="my-class"` and make their text bold.
27+
## 3. ID Selector
28+
29+
Selects a single element with a specific ID attribute.
30+
31+
Example:
32+
```css
33+
#my-id {
34+
background-color: yellow;
35+
}
36+
```
37+
This will select the element with `id="my-id"` and give it a yellow background.
38+
39+
## 4. Attribute Selector
40+
41+
Selects elements based on their attribute values.
42+
43+
Example:
44+
45+
```css
46+
input[type="text"] {
47+
border: 1px solid #ccc;
48+
}
49+
```
50+
This will select all `<input>` elements with `type="text"` and give them a 1px solid border with color #ccc.
51+
52+
## 5. Pseudo-Classes
53+
54+
Selects elements based on their state or position.
55+
56+
Example:
57+
```css
58+
a:hover {
59+
color: red;
60+
}
61+
```
62+
This will select all `<a>` elements when hovered over and make their text red.
63+
64+
## 6. Pseudo-elements
65+
66+
Selects and styles a part of an element.
67+
Example:
68+
69+
```css
70+
71+
p::first-line {
72+
font-weight: bold;
73+
}
74+
```
75+
This will select and make the first line of all `<p>` elements bold.

docs/CSS/css-basics/basic-syntax.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Basic Syntax
2+
3+
CSS (Cascading Style Sheets) follows a simple syntax for styling HTML elements. Each CSS rule consists of a selector, followed by a set of declarations enclosed in curly braces.
4+
5+
Example CSS rule:
6+
7+
```css
8+
selector {
9+
property: value;
10+
}

docs/CSS/css-basics/readme.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
## Topics Covered in CSS
3+
4+
### 1. Basic Syntax
5+
Understanding the structure and syntax of CSS rules, including selectors, properties, and values.
6+
7+
### 2. Selectors
8+
Different types of selectors to target HTML elements for styling, such as element selectors, class selectors, ID selectors, attribute selectors, pseudo-classes, and pseudo-elements.
9+
10+
### 3. Box Model
11+
Understanding the box model, which describes how elements are structured in CSS, including content, padding, border, and margin.
12+
13+
### 4. Typography
14+
Styling text elements with properties like font-family, font-size, font-weight, line-height, text-align, text-decoration, and text-transform.
15+
16+
### 5. Colors and Backgrounds
17+
Applying colors to elements using properties like color, background-color, opacity, gradients, and background images.
18+
19+
### 6. Layout
20+
Creating layouts and positioning elements using properties like display, position, float, flexbox, and grid.
21+
22+
### 7. Responsive Design
23+
Designing web pages that adapt to different screen sizes and devices using techniques like media queries and responsive units (like percentages and ems).
24+
25+
### 8. Transitions and Animations
26+
Adding dynamic effects to elements with properties like transition, animation, and keyframes.
27+
28+
### 9. Transforms
29+
Modifying the appearance of elements in 2D or 3D space using properties like transform, translate, rotate, scale, and skew.
30+
31+
### 10. Pseudo-classes and Pseudo-elements
32+
Understanding and using pseudo-classes (:hover, :focus, :active) and pseudo-elements (::before, ::after) to style elements based on their state or create decorative elements.
33+
34+
### 11. Selectors Specificity and Inheritance
35+
Understanding how CSS specificity affects which styles are applied to elements and how inheritance works in CSS.
36+
37+
### 12. Units
38+
Understanding different units of measurement in CSS, including pixels, percentages, ems, rems, viewport units, and others.
39+
40+
41+
42+
## 13. CSS Grid and Flexbox
43+
Comprehensive knowledge of CSS Grid and Flexbox layout models for creating complex and responsive layouts.

docs/CSS/readme.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Cascading Style Sheets
2+
3+
## What is CSS
4+
CSS (Cascading Style Sheets) is a stylesheet language used to describe the presentation of a document written in HTML or XML. CSS defines how elements should be rendered on screen, on paper, in speech, or on other media.
5+
6+
## Core Concepts
7+
1. Selectors:
8+
Patterns used to select the elements to style.
9+
Examples include element selectors (p), class selectors (.className), ID selectors (#idName), and attribute selectors ([attribute]).
10+
11+
2. Properties and Values:
12+
Define the styles to apply to selected elements.
13+
Each property has a set of values, e.g., color: red;, font-size: 16px;.
14+
15+
3. Cascade and Inheritance:
16+
Determines which styles are applied when multiple rules match the same element.
17+
Cascade: Refers to the order of precedence based on specificity, source order, and importance.
18+
Inheritance: Certain properties can be inherited from parent elements to children, simplifying styling.
19+
20+
4. Box Model:
21+
Describes the rectangular boxes generated for elements in the document tree.
22+
Components: content, padding, border, and margin.
23+
24+
5. Layouts:
25+
Techniques to arrange elements on the page, such as Flexbox and Grid Layout.
26+
Provides powerful tools for creating complex and responsive designs.
27+
28+
## Usage Examples
29+
30+
1. Inline CSS:
31+
32+
Applied directly to an HTML element using the style attribute.
33+
```html
34+
<p style="color: blue; font-size: 14px;">Hello World</p>
35+
```
36+
37+
2. Internal CSS:
38+
39+
Defined within a `<style>` tag in the HTML document's `<head>` .
40+
41+
```html
42+
<head>
43+
<style>
44+
p {
45+
color: blue;
46+
font-size: 14px;
47+
}
48+
</style>
49+
</head>
50+
```
51+
52+
3. External CSS:
53+
54+
Linked via a separate .css file, using the `<link>` tag.
55+
56+
```html
57+
<head>
58+
<link rel="stylesheet" type="text/css" href="styles.css">
59+
</head>
60+
```
61+

0 commit comments

Comments
 (0)