html css notes 1
html css notes 1
—-----------------------------------------------------------------------------
Introduction
Web:
Web is a collection of information. i.e in the form of text / web pages / websites.
Webpage:
Website:
Network:
Two or more computers that are connected with one another for the purpose
PRAJWAL. C
Browser:
Browser is a client side application which is used to send requests and get
Server:
PRAJWAL. C
Https stands for HyperText Transfer Protocol Secure.
Webpage:
Or
These are the webpages which will display the same information for all users.
Dynamic Webpage:
—-----------------------------------------------------------------------------
PRAJWAL. C
HTML
HTML:
Html stands for Hyper Text Markup Language.
It helps us to create web pages.
The current version of html is html5.
Structure of HTML:
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
</head>
<body>
</body>
</html>
Doctype html:
It is used to declare the version of html as html5.
Html:
It is the root element which contains the head section and body section.
Head:
It holds the meta data.
Title:
Body:
This is the place where we have to write all the code which has to be displayed on UI.
PRAJWAL. C
Tags
Tags are the predefined keywords which are enclosed in angular braces. The
task of each tag has been already declared.
Syntax:
<tagname> content </tagname>
Ex:
<p> Hello world </p>
<b> Hello world </b>
Types of Tags:
HTML tags were categorized into 2 ways. They
are:
1. Paired Tags
2. UnPaired Tags
Paired Tags:
A tag which is required of both opening and closing tags are called paired tags.
Ex: <p> Hello Web Dev </p> Unpaired Tags:
A Tag which does not require a closing tag is called unpaired tag.
Ex: <br> , <hr> , <input>
Heading Tags
Heading Tags are basically used to provide title or subtitle to the content in the webpage.
We have a set of heading tags from h1 to h6.
Where h1 is highest in font size and h6 is lowest in font size.
Default Sizes: h1 → 2 em
h2 → 1.5 em
h3 → 1.17 em
h4 → 1 em h5
→ 0.83 em h6
→ 0.67 em
PRAJWAL. C
Note: 1 em = 16px
Formatting Tags
Deprecated Tags:
PRAJWAL. C
Html Elements were classified into 2 ways
1. Inline Level
2. Block Level
Inline Level:
● We cannot assign height and width properties for the inline elements.
Block Level:
PRAJWAL. C
● These elements will occupy the whole viewport width.
Attributes
Image Tag
is an inline-block element.
PRAJWAL. C
Anchor Tag
Anchor tag helps us to navigate from one web page to another webpage.
Attributes:
link → purple.
Marquee Tag
Syntax:
PRAJWAL. C
Whatever we provide in the content place will scroll, content like text / images /
are:
1. Ordered List
2. Unordered List
3. Description List
1. Ordered List:
PRAJWAL. C
● Ordered list group a set of related items in a sequential format.
● Tags:
● Attributes:
Values = 1 (default) , A , a , I , i
2. Unordered List:
● Unordered List is used to display a set of related items with special symbols.
● Tags:
● Attributes:
PRAJWAL. C
○ Type → Specifies the type of symbol.
● Description List is used to display the description data along with description terms.
● Tags:
Tables
HTML Tables allow us to store the data in the form of rows and columns.
Tags:
PRAJWAL. C
● tfoot → It combines all the footer cells together.
Attributes:
○ Cellpadding → It will provide the space between the content and cell border.
Forms
Form is a block level element and most of the form elements are inline level.
of Form:
1. form
PRAJWAL. C
2. label
3. input
4. select
5. optgroup
6. option
7. datalist
8. fieldset
9. legend
10. textarea
11. button
Form:
<form>
.
.
form elements
.
.
</form>
Label:
PRAJWAL. C
It specifies the purpose of the input field.
Input:
To link label tag and input tag we have to use for and id attributes.
<label for="userName">Name:</label>
<input type="text" id="userName">
<label for="userEmail">Email:</label>
<input type="email" id="userEmail">
Select:
Option:
Ex:
PRAJWAL. C
<optgroup label="database">
<option value="SQL">SQL</option>
<option value="MongoDB">MongoDB</option>
</optgroup>
<optgroup label="backend">
<option value="Python">Python</option> <option
value="Java">Java</option>
<option value="NodeJs">NodeJs</option> </optgroup>
</select>
<label>Skills:</label>
Datalist:
Datalist is also used to create a dropdown list just like select tag.
But, here we can sort the options based on initial letters. Here
Ex:
PRAJWAL. C
<label>Skills:</label>
<input list="skillsList">
<datalist id="skillsList">
<option value="React">React</option>
<option value="Angular">Angular</option> <option
value="SQL">SQL</option>
Fieldset: <option value="MongoDB">MongoDB</option>
<option value="Python">Python</option>
<option value="Java">Java</option>
<option value="NodeJs">NodeJs</option>
</datalist>
This tag is used to group the set of fields together that will display a border to
those fields.
Legend:
Ex:
<fieldset>
<legend>Personal Details</legend>
. .
form elements .
.
</fieldset>
Textarea:
rows and cols attributes specify the visible height and width of textarea.
Ex:
Button:
Ex:
PRAJWAL. C
<button type="reset">Reset</button>
<button type="submit">Submit</button>
1. type
2. id
3. name
4. value
5. list
6. multiple
7. readonly
8. disabled
9. required
10. placeholder
11. min
12. max
13. minlength
14. maxlength
15. step
16. size
PRAJWAL. C
17. autofocus
18. autocomplete
19. pattern
1. text
2. email
3. password
4. number
5. tel
6. radio
7. checkbox
8. button
9. submit
10. reset
11. search
12. date
13. time
14. datetime-local
PRAJWAL. C
15. week
16. month
17. color
18. image
19. file
20. url
21. range
1. Action:
2. Method:
Get:
Data is secure. 3.
Novalidate:
PRAJWAL. C
If we want to submit without checking then we can use novalidate.
4. Auto complete:
Semantic Tags
Semantic tags are the tags which will say the purpose of it.
Example:
Header , nav , section , article , aside , main , table , form , audio , video , etc..
PRAJWAL. C
Audio Tag
Video Tag
PRAJWAL. C
Iframe Tag
Iframe tag is used to embed another web page into the current web page.
We can embed from internal web pages as well as external web pages like youtube ,
—-----------------------------------------------------------------------------
CSS
Introduction
CSS Rule:
PRAJWAL. C
selector{ propertyName1:
value1; propertyName2:
value2; .
. . propertyNameN:
valueN;
}
Types of CSS
1. Inline CSS:
It is a way of applying the CSS in the same line.
By using style attribute.
Inline CSS is a way to apply styles directly to an HTML element using the
style attribute
Ex:
2. Internal CSS:
It is a way of adding the CSS in the same html file itself.
By using Style Tag.
We can use style tag anywhere in the html file. It’s recommended to use in a
head tag.
Internal CSS is a method of styling where CSS rules are written inside a
<style> tag within the <head> section of an HTML document. It applies styles
to the entire document but is not separate from the HTML file.
PRAJWAL. C
Ex:
<html>
<head>
<title>Document</title>
<style> h1 { color: white;
background-color: blue;
}
</style>
</head>
<body>
<h1>Let's dive into CSS</h1>
</body>
</html>
3. External CSS:
It is a way of writing all the css code in one file which is saved with .css
extension.
That css file we have to link to the html file by using the link tag.
External CSS is a method of styling where CSS rules are written in a
separate .css file and linked to an HTML document using the <link> tag inside
the <head> section.
PRAJWAL. C
/* style.css */ h1 {
color: white; background-
color: blue;
}
Note:
1. The first will always be taken by inline CSS. because of the most recent
update.
2. Internal vs External depends on code flow which is written at last.
CSS Selectors
To apply the css Properties, we can target the html elements in many ways.
They are:
1. Simple Selector
2. Combinator Selector
3. Pseudo Class Selector
4. Pseudo Element Selector
5. Attribute Selector
Selectors
1. Simple Selectors:
PRAJWAL. C
To target the element based on classes / id’s / tagname we have basic selectors.
They are:
1. TagName
2. Grouping
3. Universal
4. Id Name
5. Class Name
● TagName:
○ To target the element based on tagname itself we have to use tagName
selector.
○ The symbol was the tagname itself.
● Grouping:
○ To target multiple elements at a time we have to use a grouping
selector.
○ Whenever we need to pass similar properties for multiple elements we
can use a grouping selector.
○ The symbol used to combine all elements is comma (,) ●
Universal:
○ It will target all the elements in the document including body tag too.
○ The symbol used is asterisk (*).
● Id Name:
○ To target the elements uniquely we have to use an id name.
○ In CSS id name can be duplicated also there is no problem,
○ But once we moved to advanced languages.
○ Repetition of id name will not work. So it is highly recommended not to
use it from now on.
○ The Symbol used is hash (#).
● Class Name:
○ To target the specific elements on the basis of class name we have to
use class name.
○ Class attribute allows multiple identifier names in the same attribute.
○ Class names can be repetitive also.
○ The symbol used is dot (.).
PRAJWAL. C
2. Combinator Selectors:
It is a combination of 2 simple selectors.
Based on the relation b/w 2 elements the css will target the elements.
Combinator selectors are used to define relationships between elements. They help
select elements based on their position in relation to other elements.
They are:
1. Descendent Selector
2. Direct Child Selector
3. Adjacent Sibling Selector
4. General Sibling Selector
● Descendent Selector:
○ It will target all the children, grandchildren , great grandchildren and
so on.
Selects elements inside another elements
○ The symbol used is space ( ).
● Direct Child Selector:
○ It will target only the children but not grandchildren , great
grandchildren and so on.
Selects direct children of an element
○ The symbol used is greater than ( > ).
● Adjacent Sibling Selector:
○ It will target only the first sibling of the element.
Selects the immediate next sibling of an element
○ The symbol used is plus ( + ).
● General Sibling Selector:
○ It will target all the first siblings of the element.
Selects all siblings after a specific element
○ The symbol used is plus ( ~ tildle ).
PRAJWAL. C
:hover → Styles an element when the user hovers over it.
:focus → Styles an element when it is focused (e.g., an input field).
:active → Styles an element when it is being clicked.
:visited → Styles a link after it has been visited.
:checked → Styles a checkbox or radio button when checked.
They are:
● :hover → It will apply the properties whenever we move the cursor on the element.
● :first-child → It will target only the first child.
● :last-child → It will target only the last child.
● :nth-child (even / odd / 2n / 2n+1 ) → It will target the specific child based on
the parameter.
● :first-of-type → It will target the first child of each type ● :last-of-type → It
will target the last child of each type
4. Pseudo Element Selectors These are the special selectors. The symbol used is single solon
(:).
5. A pseudo-element selector is used to style specific parts of an element without modifying
the HTML structure.
They are:
● ::first-letter → It will target only the first letter of content.
● ::first-line → It will target only the first line of content.
● ::before → It will add the content before the element.
● ::after → It will add the content before the element.
● ::selection → while selecting the content by default it will show color:
“white” & background-color: “blue”. To change the default behaviour we can
use this.
● ::marker → It will target the type attribute of lists.
6. Attribute Selectors
PRAJWAL. C
It will target the elements based on attribute name.
Instead of creating new id names and class names we can use existing attributes.
1. TagName[attribute]
2. TagName[attribute=”Value”]
Text Properties
Text Properties are basically used to apply CSS effects on text content.
Text properties are:
1. color
2. text-align
3. text-transform
4. text-decoration
5. text-indent
6. text-wrap
7. letter-spacing
8. word-spacing
9. line-height
10. text-shadow
1. color:
It will change the color of the text. Syntax:
color : value;
Values = Any Color.
2. text-align:
It is used to align the content based on the value.
Syntax: text-align : value;
Values = left / start , center , right / end , justify
3. text-transform:
It will convert the text into other formats.
Syntax: text-transform : value;
Values = lowercase , uppercase , capitalize.
PRAJWAL. C
4. text-decoration:
It will decorate the text by providing underlines or overlines with special styles. It
is a shorthand property of text-decoration-line , text-decoration-style & text-
decoration-color.
Syntax: text-decoration: text-decoration-line text-decoration-style text-
decoration-color
Values= text-decoration-line ⇒ underline , overline , line-through
text-decoration-style ⇒ solid , dashed , dotted , double , wavy.
text-decoration-color ⇒ any color.
Note: out of 3 properties text-decoration-line is mandatory.
5. text-indent:
It will provide the space at the initial position of the content. Syntax:
text-indent : value;
Values = any number.
6. text-wrap:
It will indicate whether to wrap the content into the next line or not. Syntax:
text-wrap : value;
7. letter-spacing;
It will specify the space between the letters.
Syntax: text-spacing : value; Values = any
number.
8. word-spacing:
It will specify the space between the words. Syntax:
text-spacing : value;
Values = any number.
PRAJWAL. C
9. line-height:
It will specify the height of the line. Syntax:
line-height : value;
Values = any number.
10. text-shadow:
It will specify the shadow for text content.
Syntax: text-shadow : x-axis y-axis blur color;
Default values: text-shadow : 0px 0px 0px black;
Ex: text-shadow : 2px 2px 3px blue;
Font Properties
Font properties are used to apply CSS effects of size , boldness , styles , etc.
Font properties are:
1. font-size
2. font-weight
3. font-style
4. font-family
5. font-variant
1. font-size:
It will specify the size of text content.
Syntax: font-size: value;
Values = xx-small , x-small , small , medium , large , x-large , xx-large , any number.
2. font-weight:
It will specify the boldness of the content.
Syntax: font-weight: value;
Values = 100 - 900 , lighter , normal , bold / bolder.
3. font-style:
PRAJWAL. C
It will specify the style of text like it should be italic or normal.
Syntax: font-style : value;
Values = normal , italic / oblique.
4. font-family:
It will specify the font family of text content.
Syntax: font-family : value;
Values = 1. From vs code 2. Google fonts.
5. font-variant:
It will be displayed in upper camel case formats.
Syntax: font-variant : value; Values
= normal , small-caps
Background Properties
1. background:
It is a shorthand property of multiple background properties.
Instead of writing all properties we can pass all values over here.
2. background-color:
It will specify the background color of an element.
Syntax: background-color : value;
Values = Any color.
3. background-image:
It will specify the background image of an element. Syntax:
background-image : value;
PRAJWAL. C
Values = url(“pathaddress”).
4. background-repeat:
By default,the background image will repeat.
To prevent repetition of images we can use this property.
Syntax: background-repeat: value;
Values = repeat , no-repeat , repeat-x , repeat-y
5. background-position:
It will specify the position of the background image.
It is a shorthand property of background-position-x and background-position-y.
Syntax: background-position : background-position-x background-position-y
Values = background-position-x ⇒ left , center , right
Background-position-y ⇒ top , center , bottom
6. background-size:
It will specify how to fit the image into a container. Syntax:
background-size : value;
Values = auto , contain , cover.
7. background-attachment:
It will decide the behavior of the background image. That has to scroll or fixed.
Syntax: background-attachment : values;
Values = scroll , fixed.
Border Properties
Border properties are used to apply the CSS effects to the border of an element.
1. border:
It is a shorthand property of border-width , border-style and border-color.
Syntax: border: border-width border-style border-color
2. border-width:
It will specify the width of the border. Syntax:
border-width: any number;
PRAJWAL. C
3. border-style:
It will specify the style of the border.
Syntax: border-style:Values;
Values: solid , dashed , dotted , double , groove , ridge , none.
4. border-color:
It will specify the color of the border. Syntax:
border-style: any color;
5. border-top/bottom/left/right:
If we need to specify the border only at one side we can use border - top / border
- bottom / border - left / border-right.
6. border-collapse:
This is a property to apply effects on tables.
It will decide whether the table cells have to separate or not. Syntax:
border-collapse: values;
Values: separate , collapse.
7. border-spacing:
It is an alternative to the cellspacing attribute of a table tag.
It will specify the space b/w cells in a table. Syntax:
border-spacing : any number;
Box Model
By default, each and every element has default padding and margin.
These default values will disturb our websites when we are layouting the webpages.
To come out of these problems mainly we use this box model concept.
The CSS Box Model is a fundamental concept that explains how elements are structured
and spaced in a webpage. Every HTML element is treated as a rectangular box with the
following layers:
PRAJWAL. C
This model contains mainly 4 boxes.
1. Content box
2. Padding box
3. Border box
4. Margin box
• Content – The actual content inside the box (text, image, etc.).
• Border – The outer edge surrounding the padding (can be styled with color, width, etc.).
• Margin – The space outside the border that separates elements from each other.
1. Content:
It specifies the content area of an element.
It includes content height and width (not element height & width).
2. Padding:
It specifies the space between border and content of an element.
Ex: padding: 5px; padding:
10px;
3. Border:
It specifies the border to an element. Ex:
border : 2px solid blue;
PRAJWAL. C
4. Margin:
It specifies the space around the element.
Ex: margin: 5px; margin:
10px; Note: margin
is a shorthand
property of margin-
top , margin-bottom
, margin-left ,
margin-right.
We can pass
Margin : 10px 20px 30px 40px;
T R B L
Margin : 10px 20px 30px;
T L/R B
Margin : 10px 20px; T/B
L/R
Margin : 10px;
T/B/L/R
Same as for padding property also.
Height Calculation:
Total height of element = margin-top + border-top + padding-top + content-height +
padding-bottom + border-bottom + margin-bottom
Width Calculation:
Total width of element = margin-left + border-left + padding-left + content-width +
padding-right + border-right + margin-right
PRAJWAL. C
The main point over here is that content height is different from the rest of
properties.
For example if i specified height: 100px; padding:10px; so the total height will be
120px.
But if we need fix the size of the element we have to use box-sizing:border;
And To remove the default margin and padding of each element we have to use
margin:0; padding:0; So we have to use
Box-shadow:
It will specify the shadow of an element.
Syntax: box-shadow: x-axis y-axis blur spread color inset;
Ex: box-shadow: 2px 2px 2px 3px blue; Ex:
box-shadow: 2px 2px 2px 3px blue inset;
Positions
PRAJWAL. C
2. Relative
3. Absolute
4. Fixed
5. Sticky
To deal with positions we have to use helping properties.
They are:
1. top
2. bottom
3. left
4. right
1. Static:
a. It is the default value.
b. It will not perform any changes to the element.
c. Helping properties was not required.
2. Relative:
a. It will change the position of an element with respect to the original
position.
b. It will leave an empty space. It doesn’t allow other elements to occupy its
place.
3. Absolute:
a. It will change the position of an element with respect to the parent.
b. By default the parent is a viewport, if we need to change we have to pass
position:relative for parent element.
c. It will not leave any empty space. It allows other elements to occupy its
place.
d. If we provide position:absolute for all the elements , all elements will float
on each other.
e. To specify which element has to float top or bottom , we have to use the z-
index property.
4. Fixed:
a. It will fix the position of an element.
b. To fix the position we have to mention the helping properties.
5. Sticky:
a. Initially these elements will scroll until it reaches to some point.
b. Then it will stick at that position.
Note:
PRAJWAL. C
If we specify the position as relative / absolute / fixed / sticky elements
will float on the z-axis.
All of the above need the help properties.
We should not use top and bottom / left and right at a time.
Display
PRAJWAL. C
● It will layouts the webpages in two dimensional format.
Flex
There are many properties which we can apply only to the container as well as only to the
items.
Flex-container Properties are:
1. display:flex
2. justify-content
3. align-items
4. flex-direction
5. flex-wrap
6. align-content
7. column-gap
8. row-gap
9. gap
1. display: flex:
This is the main property we must use to work with flex boxes.
By assigning this property we are able to use all flex properties.
PRAJWAL. C
2. Justify-content:
3. align-Items:
It will align the flex-items on the cross axis.
Syntax: align-items: values;
Values = start , center , end , stretch , baseline.
The default value is start.
PRAJWAL. C
4. flex-direction:
It will specify the direction of flex-items.
Whether to display in row format or column format. It
will decide the main axis.
Syntax: flex-direction: values;
Values = row , column , row-reverse , column-reverse.
The default value is row.
PRAJWAL. C
5. flex-wrap:
It will specify whether to wrap the flex-items into the next line or not.
6. align-content:
PRAJWAL. C
It will specify the position of wrapped flex items.
7. gap:
It is a shorthand property of row-gap & column-gap.
It will specify the space between the flex items.
Ex: row-gap:20px & column-gap:20px; / gap: 20px 20px;
Ex: gap:20px;
PRAJWAL. C
Flex-items Properties are:
1. order
2. align-self
3. flex-grow
4. flex-basis
5. flex-shrink
6. flex
1. Order:
It will arrange the flex-items in an order.
Ex:
.item1 {
order: 4;
}
.item2 {
order: 1;
}
.item3 {
order: 2;
}
.item4 {
order: 3;
}
PRAJWAL. C
2. align-self:
By using this property, we can align the flex-items individually.
It will override the default alignment which is specified by align-items.
It will accept all the values which can be acceptable by align-items property.
The only difference is
i. align-items for container for all flex-items.
ii. align-self for items for individual flex-item.
3. Flex-grow:
It will make sure the flex-items have to fit to the flex-container.
It will increase the size of the flex–items based on remaining space.
The remaining space in a container will be divided into units and it will
be added to each flex-item based on flex-grow values. Ex:
.item1 {
flex-grow: 0;
}
.item2 {
flex-grow: 0;
}
.item3 {
flex-grow: 0;
}
PRAJWAL. C
.item1 { flex-grow:
1;
}
.item2 { flex-grow:
1;
}
.item3 { flex-grow:
1;
}
.item1 { flex-grow:
1;
}
.item2 { flex-grow:
2;
}
4. flex- basis
.item3 { flex-grow:
It is equivalent to 1;
the width }
property.
Ex:
.item1 {
PRAJWAL. C
width: 200px;
}
.item2 { width:
100px;
}
.item3 { width:
200px;
}
.item1 { flex-basis:
200px;
5. flex- shrink:
}
.item2 { flex-basis:
100px;
}
.item3 { flex-basis:
200px;
}
For example:
The width of container is 800px;
And with provided to items is 300px;
So to fit 300 + 300 + 300 = 900 px into an 800px container all items will
PRAJWAL. C
shrink equally.
6. flex:
It is a shorthand
property of flex- But our need is that we may shrink item2 and item3 but item1 must take
grow , flex-shrink 300px.
and flex-basis. So, we target item2 & item3 and specify the flex-shrink value.
Ex: flex: 1
If we specify flex 1 , it will increase , decrease , and width equally.
Grid
1. display:grid
2. grid-template-columns
3. grid-template-rows
4. column-gap
5. row-gap
6. gap
1. display:grid
PRAJWAL. C
b. As the width of the cell is defined here, It is not required to mention again
for the grid item.
div { background-color:
chocolate; border: dashed;
text-align: center;
}
PRAJWAL. C
3. grid-template-rows:
a. It will specify no.of rows along with the height of each column.
b. As the height of the cell is defined here, It is not required to mention again
for the grid item. Ex:
PRAJWAL. C
We can pass the values for grid-template-rows and grid-template-columns in
multiple ways.
4. gap:
a. It will specify the space between the grid items.
b. It is the shorthand property of row-gap & column-gap.
/* CSS Code */
PRAJWAL. C
section { row-gap:
5px; column-gap:
20px; ===== or
====== gap: 5px
20px;
}
Grid Items
Properties are:
1. grid-row-start
2. grid-row-end
3. grid-column-start
4. grid-column-end
5. grid-row
6. grid-column
7. grid-area
1. grid-row:
a. It is a shorthand property of grid-row-start and grid-row-end.
b. Grid-row-start will specify where to start the row.
c. Grid-row-end will specify where to end the row.
d. Syntax: grid-row: grid-row-start/grid-row-end
e. Ex: grid-row: 1/5;
f. Ex:
g.
PRAJWAL. C
* { margin: 0; padding:
0; box-sizing: border-
box;
}
div { background-color:
chocolate; border: dashed;
text-align: center;
}
PRAJWAL. C
2. grid-column:
a. It is a shorthand property of grid-column-start and grid-column-end.
b. Grid-column-start will specify where to start the column.
c. Grid-column-end will specify where to end the column.
d. Syntax: grid-column: grid-column-start/grid-column-end
e. Ex: grid-column: 1/5;
f. Ex:
g.
PRAJWAL. C
3. grid-area:
a. It is the shorthand property of grid-row-start , grid-column-start , grid-
row-end and grid-column-end.
b. Syntax: grid-row-start/grid-column-start/grid-row-end/grid-column-end. c.
Ex:
d.
PRAJWAL. C
Transform
Transform will change the state of an element like changing position , applying
rotations , altering sizes, etc…
======== or ===========
It will transform the elements original behavior with new behaviors like changing
positions , applying rotations , altering sizes , etc..
Syntax: transform: value;
Values: translateX() translateY() translate()
scaleX() scaleY() scale()
skewX() skexY() skew()
rotateX() rotateY() rotate()
Translate():
It will change the position of an element according to x-axis and y-axis.
It is a shorthand property of translateX() → which
will according to x-axis
And translateY() → which will
according to y-axis
Ex: transform: translateX(200px);
transform: translateY(400px); transform:
translate(200px , 400px);
Scale():
It will alter the sizes of an element based on the scale value provided either to
increase or decrease.
By default, the scale is 1.
Ex: transform: scaleX(2); // It will increase the width into double.
transform: scaleY(0.5); // It will decrease the height into half.
transform: scale(2,0.5); // It will increase the width & decrease the height.
Skew():
It will slant the elements in x and y axises.
Ex: transform: skewX(40deg);
transform: skewY(20deg); transform:
skew(40deg , 20deg); Rotate():
PRAJWAL. C
It will rotate the element in clockwise and anticlockwise directions.
Ex: transform: rotateX(90deg); transform:
rotateY(180deg); transform:
rotate(90deg); // clockwise transform:
rotate(-90deg); // anticlockwise
Transition
Transition-property:
It will specify which properties have to be targeted. (In hover we will have many
properties , for which property transition have to apply).
If we are not targeted specifically, It will target all.
Transition-duration:
It specifies how long the transition has to occur. The
default is 0 secs.
Transition-delay:
It specifies when the transition has to apply.
Basically, it provides a delay time. So transition will start after that time. The
default is 0 secs.
Transition-timing-function:
It specifies the speed format of transition.
We can assign the values like ease-in
→ slow start ease-out → slow
PRAJWAL. C
end ease-in-out → slow start
and slow end ease → slow
start , fast , slow end linear
→ same speed
Animation
Animations will change the style of an element from one style to another style to
another style and so on.
Animation is a shorthand property of
Animation-name
Animation-duration
Animation-delay
Animation-timing-function
Animation-direction
Animation-iteration-count
As we said, animation will change from one style to another and so on. To store all these
styles we have to use @keyframes rule.
Syntax:
@keyframes identifier {
from{
// code
} to{
// code
}
Animation-name:
It specifies the animation-name which is nothing the @keyframes rule identifier
name.
We can create @keyframes rules with different styles.
Which animation you want to use, you can specify that identifier name.
PRAJWAL. C
Animation-duration:
It specifies how the animation has to apply.
Animation-delay:
It specifies when the animation has to start.
Animation-timing-function:
It specifies the speed format of animation.
We can assign the values like ease-in → slow
start ease-out → slow end ease-in-
out → slow start and slow end ease →
slow start , fast , slow end linear →
same speed
Animation-direction:
It specifies the direction of animation.
We can assign the values normal , reverse , alternate and alternate-reverse.
Animation-iteration-count:
It specifies how many times the animation has to apply.
We can assign any number or infinite.
CSS Units
PRAJWAL. C
4. Px Relative Units:
These units are dynamic, It will depend on some other values.
Relative Units are:
1. vw → depends on viewport width
2. vh → depends on viewport height
3. % → depends on parent element
4. rem → depends on root element
5. em → depends on parent element
CSS Responsiveness
// code
MediaType:
It will specify the type of view mode.
It will accept the values like all, screen , print. The
default value is all.
MediaOperator:
This will combine multiple media features.
It will accept the values like and , or , not.
And → it will check if all the conditions are true or not.
Or → it will check if any of the conditions are true or not.
MediaFeatures:
PRAJWAL. C
It will provide some breakpoints based on screen sizes.
It will accept the values like:
1. min-width
2. max-width
3. width
4. min-height
5. max-height
6. height
7. orientation: landscape / portrait
Ex:
@import:
It will import the css files into a css file based on media conditions Ex:
PRAJWAL. C
-----------------------------------------------------------------------------------------------------------
JavaScript
PRAJWAL. C