-
-
Notifications
You must be signed in to change notification settings - Fork 157
Added CSS in docs #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Added CSS in docs #314
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1da56e5
Create readme.md
AmrutaJayanti 9a0b7e4
Create basic-syntax.md
AmrutaJayanti bdd97f0
Create Selectors.md
AmrutaJayanti 1eb223d
Create readme.md
AmrutaJayanti 7080c05
Create Selectors.md
AmrutaJayanti d74e428
Delete docs/CSS/Selectors.md
AmrutaJayanti cc608d4
Create basic-syntax.md
AmrutaJayanti 482dee9
Delete docs/CSS/basic-syntax.md
AmrutaJayanti bb80bb7
Update readme.md
AmrutaJayanti 29ce6aa
Update readme.md
AmrutaJayanti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# CSS Selectors | ||
|
||
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: | ||
|
||
## 1. Element Selector | ||
|
||
Selects HTML elements based on their element type. | ||
|
||
Example: | ||
```css | ||
p { | ||
color: blue; | ||
} | ||
``` | ||
This will select all `<p>` elements and make their text blue. | ||
## 2. Class Selector | ||
|
||
Selects elements with a specific class attribute. | ||
|
||
Example: | ||
```css | ||
.my-class { | ||
font-weight: bold; | ||
} | ||
``` | ||
This will select all elements with `class="my-class"` and make their text bold. | ||
## 3. ID Selector | ||
|
||
Selects a single element with a specific ID attribute. | ||
|
||
Example: | ||
```css | ||
#my-id { | ||
background-color: yellow; | ||
} | ||
``` | ||
This will select the element with `id="my-id"` and give it a yellow background. | ||
|
||
## 4. Attribute Selector | ||
|
||
Selects elements based on their attribute values. | ||
|
||
Example: | ||
|
||
```css | ||
input[type="text"] { | ||
border: 1px solid #ccc; | ||
} | ||
``` | ||
This will select all `<input>` elements with `type="text"` and give them a 1px solid border with color #ccc. | ||
|
||
## 5. Pseudo-Classes | ||
|
||
Selects elements based on their state or position. | ||
|
||
Example: | ||
```css | ||
a:hover { | ||
color: red; | ||
} | ||
``` | ||
This will select all `<a>` elements when hovered over and make their text red. | ||
|
||
## 6. Pseudo-elements | ||
|
||
Selects and styles a part of an element. | ||
Example: | ||
|
||
```css | ||
|
||
p::first-line { | ||
font-weight: bold; | ||
} | ||
``` | ||
This will select and make the first line of all `<p>` elements bold. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Basic Syntax | ||
|
||
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. | ||
|
||
Example CSS rule: | ||
|
||
```css | ||
selector { | ||
property: value; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
## Topics Covered in CSS | ||
|
||
### 1. Basic Syntax | ||
Understanding the structure and syntax of CSS rules, including selectors, properties, and values. | ||
|
||
### 2. Selectors | ||
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. | ||
|
||
### 3. Box Model | ||
Understanding the box model, which describes how elements are structured in CSS, including content, padding, border, and margin. | ||
|
||
### 4. Typography | ||
Styling text elements with properties like font-family, font-size, font-weight, line-height, text-align, text-decoration, and text-transform. | ||
|
||
### 5. Colors and Backgrounds | ||
Applying colors to elements using properties like color, background-color, opacity, gradients, and background images. | ||
|
||
### 6. Layout | ||
Creating layouts and positioning elements using properties like display, position, float, flexbox, and grid. | ||
|
||
### 7. Responsive Design | ||
Designing web pages that adapt to different screen sizes and devices using techniques like media queries and responsive units (like percentages and ems). | ||
|
||
### 8. Transitions and Animations | ||
Adding dynamic effects to elements with properties like transition, animation, and keyframes. | ||
|
||
### 9. Transforms | ||
Modifying the appearance of elements in 2D or 3D space using properties like transform, translate, rotate, scale, and skew. | ||
|
||
### 10. Pseudo-classes and Pseudo-elements | ||
Understanding and using pseudo-classes (:hover, :focus, :active) and pseudo-elements (::before, ::after) to style elements based on their state or create decorative elements. | ||
|
||
### 11. Selectors Specificity and Inheritance | ||
Understanding how CSS specificity affects which styles are applied to elements and how inheritance works in CSS. | ||
|
||
### 12. Units | ||
Understanding different units of measurement in CSS, including pixels, percentages, ems, rems, viewport units, and others. | ||
|
||
|
||
|
||
## 13. CSS Grid and Flexbox | ||
Comprehensive knowledge of CSS Grid and Flexbox layout models for creating complex and responsive layouts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Cascading Style Sheets | ||
|
||
## What is CSS | ||
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. | ||
|
||
## Core Concepts | ||
1. Selectors: | ||
Patterns used to select the elements to style. | ||
Examples include element selectors (p), class selectors (.className), ID selectors (#idName), and attribute selectors ([attribute]). | ||
|
||
2. Properties and Values: | ||
Define the styles to apply to selected elements. | ||
Each property has a set of values, e.g., color: red;, font-size: 16px;. | ||
|
||
3. Cascade and Inheritance: | ||
Determines which styles are applied when multiple rules match the same element. | ||
Cascade: Refers to the order of precedence based on specificity, source order, and importance. | ||
Inheritance: Certain properties can be inherited from parent elements to children, simplifying styling. | ||
|
||
4. Box Model: | ||
Describes the rectangular boxes generated for elements in the document tree. | ||
Components: content, padding, border, and margin. | ||
|
||
5. Layouts: | ||
Techniques to arrange elements on the page, such as Flexbox and Grid Layout. | ||
Provides powerful tools for creating complex and responsive designs. | ||
|
||
## Usage Examples | ||
|
||
1. Inline CSS: | ||
|
||
Applied directly to an HTML element using the style attribute. | ||
```html | ||
<p style="color: blue; font-size: 14px;">Hello World</p> | ||
``` | ||
|
||
2. Internal CSS: | ||
|
||
Defined within a <style> tag in the HTML document's <head>. | ||
|
||
```html | ||
<head> | ||
<style> | ||
p { | ||
color: blue; | ||
font-size: 14px; | ||
} | ||
</style> | ||
</head> | ||
``` | ||
|
||
3. External CSS: | ||
|
||
Linked via a separate .css file, using the <link> tag. | ||
|
||
```html | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="styles.css"> | ||
</head> | ||
``` | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad practice:
Good Practice: