Jamshaid
Jamshaid
<element></element> ---
<a href="link address" target="_blank" > About </a> --- to another page
<!---->while at top
<h1>Copyright ©</h1>
ordered list.
<ul>
</ul>
table
<table>
<tr>
<th>O</th>
<th>2</th>
<th>3</th>
</tr>
<tr>
<td>one</td>
<td>two</td>
<td>three</td>
</tr>
</table>
-----------------------------------------------------------------------
</form>
<input type="text" name="name" id="" value="enter name here"> // difference b/w placeholder and
value
csssssssssssss
inline css
internal css
external css
id selector --- html element must have attribute id="name_u_like"; //there should be unique name of id
class selector --- html element must have attribute class="nameULike"; //group all same in class
------------------------
div --- block to group elements. -- starts at newline -- block level element
span --- sub portion of element's data -- starts inline -- inline level element
----------------------------------
---------------------------------------------------------------------------------------
background-color
color names
rgb 0-255 red green blue (255,255,255)
-------------------------------------------------
absolute units dont depends upon anything. (1px is one dot at viewport)
relative units depends upon parent element. em (16px default font size of chrome browser = 1em =
16x1 = 16px).
as <p> is in body tag and body is inhereting values from browser so 2rem is 16x2 = 24px
rem : default ever (root(html) font size). uses 16xcount values to calc data for px. deos not depends on
parent element.
min-height: if the content coming after does not provide height to display, use min height.
but min-height will use its own 100vh or vw, use calc(100vh - size in of element before elemeint using
min-height)
*{
--------------------------------------------------------------
font-size: 1rem;
font-family: verdana(font-stack);
font-weight: bold;
font-style: itlic;
--------------------------------
outline-offset = move outline inside or outside of element in direction top bottom left right
--------------------------------------------------------------------------------------------
display properties
block
inline
inline-block
box-sizing:border-box;
inline level element = always starts in line(anywhere at current line) , takes only width that content is
using.
block level elements = always starts and ends at new line. takes 100% width
imp: if u want to make an inline element to be top bottom margin respected by browser, and dont want
to make it block lvl element.
use display:inline-block.
border-box = when padding is applied on an element, it is added with its heigh and width.
for example a div is of 200px width and 200px height, after applying 20px on all sides, it will be 240px by
240px.
to over come that problem, use borderbox, now padding will be added and then managed by box model
200px width and 200px height, after padding of 20px on all sides, it will be same 200px by 200px ,
internal content will be mde 160x160.
---------------------
------------------------------------------------------
background:url('image.jpg')
background-attacement // fixed
--------------------------------------------------------------------------
float -- to get element out of normal flow and stick it with left or right (newspaper mode)
clear -- to force set an element after the element having float property to use new line.
overflow -- element is floated and size greater than parent, overflow:hidden will set element inside
parent and increase parent size.
position-static -- default position set by DOM
media-quires --
// css properties that only apply if screen width is between 0px and 576px.
// css properties that only apply if screen width is between 576px and 768px.
// if screen resolution is above than 768px or below 576px, these properties wont work.
use position absolute on images and position relative on div, so position of images can be set with
respect to div parent.
img{
width: 100px;
height: 100px;
position: absolute;
}
.banner{
width: 80vw;
height: 70vh;
position: relative;
.one{
top: 0;
left: 0;
z-index: 0;
.two{
top: 10%;
left: 10%;
z-index: -1;
.three{
top: 20%;
left: 20%;
z-index: -2;
:hover
a:link
a:visited
a:active
:root{
-----------------------------------------------------
*{
margin: 0;
padding: 0;
box-sizing: border-box;
div{
width: 100px;
height: 100px;
margin: 10px;
font-size: 1.5rem;
text-align: center;
text-transform: uppercase;
font-weight: bold;
overflow: hidden;
.one{
background-color: aqua;
transition: all 2s linear;
.two{
transform: rotate(360deg);
.three{
transform: scale(2);
.four{
transform: skew(-20deg);
-----------------------------------------------
if u want all properties to be same in duration and delay, use code below.
----------------------------------------------------
animation
unlike transition property which takes places form 0 to 100% in one try,
div{
width: 100px;
height: 100px;
background-color: springgreen;
div:hover{
@keyframes move {
0%{
background-color: steelblue;
50%{
font-size: 2rem;
color: red;
overflow: hidden;
text-transform: uppercase;
border-radius: 30%;
transform: translateX(100px);
}
100%{
background-color: #222;
color: salmon;
transform: translateX(-50px);
--------------------
animation-fill-mode: usually after animation element will move to its initial stage, if u want that element
will retain the properties at last keyframe,
------------------------------------------------------------
css vars
global;
:root{
--varName:properties;
--myColor: #222;
.one{
transform : var(--myTranslate);
local vars;
can be used only by childs of parent or parent itself.
-------------------------------------------------------
text-shadow
shadow of text.
box-shadow
browser prefixes
sementic HTML
Emmet Snippts
div.container>div.item.item-$>{item $}
div.container>(div.item.item-$>{item $})*10
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div class="container">
</div>
</body>
</html>
*{
margin: 0;
padding: 0;
.container{
display: flex;
flex-direction: column;
}
.item{
flex: 0 0 300px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
font-size: 2rem;
text-transform: uppercase;
font-weight: bold;
.item-1{
background-color: turquoise;
.container{
display: grid;
height: 100vh;
grid-template-areas:
}
.item-1{
background-color: blue;
grid-area: one;
.item-1:hover{
background-color: tomato;
.item-2{
background-color: gray;
grid-area: two;
.item-3{
background-color: springgreen;
grid-area: three;
.item-4{
background-color: chartreuse;
grid-area: four;
.item-5{
background-color: cyan;
grid-area: five;
.item-6{
background-color: indigo;
grid-area: six;
.item-7{
background-color: lemonchiffon;
grid-area: seven;
.item-8{
background-color: lightgreen;
grid-area: eight;
.item-9{
background-color: navy;
grid-area: nine;
.item-10{
background-color: wheat;
grid-area: ten;