Professional Documents
Culture Documents
KD
KD
CSS ID SELECTOR
<style>
#redElement
{
color: purple;
background-color: bisque;
}
</style>
<p id="red Element">my name is sonal.</p>
footer, span{
background-color: brown;
}
</style>
<span>this is span.</span>
<footer>This is footer</footer>
p{
font-family: 'cursive', 'Franklin Gothic Medium', 'Arial Narrow',
Arial, sans-serif;
font-size: 33px; /* 1/96th of an inch */
line-height: 1.3em; /*parent ke size ke kitna gunaa hai ye em*/
font-weight: bold;
font-style: italic;
}
three ways of giving colour
1) color: purple; /*name*/
2) color: rgb(0, 255, 0); /*green colour*/
red green blue
3)color: #ffffff;
/*white colour hex colour*/
BORDER
#redElement
{
/* color: purple; */
background-color: bisque;
height: 100px;
width: 855px;
border-width: 4px;
border-color: blue;
border-style: solid; /*isse border bn jayega solid by default black
colour hai agr border colour nhi diye hai to*/
border-radius: 30px; /*rounded border jitna jyada krenge utna hi round
hote jayega. */
}
background-repeat: no-repeat;
/* repeat-x and repeat-y will make it repeat in x and y axis */
background-position: center top;
background-position: 192px top; /*position on x and y axis.
y axis me ya to center likh skte ya phir left/right top bottom sift x wale me
likhenge background-position: center left;
background-image: url('sonal.jpeg'); that image should be in same folder. you can
copy image link form google to
.container{
background-color: bisque;
border: 3px solid rebeccapurple;
padding-left: 790px; /* chaaro directions se padding hoga */
/* padding left means left se space chutega aur right me shift hoga content
*/
margin: 54px; /* from everydirection*/
}
we can set margin/padding for top,right,bottom,left like this
padding-left: 790px;
padding-right: 790px;
padding-top: 790px;
padding-bottom: 790px;
GO ON THE WEBSITE RIGHT CLICK TO INSPECT go on container put cursor on padding 23px
press up arrow key it will increase.
jaise hi x ka padding change hoga then hm dekhenge width v change ho rha jbki width
to already de chuke hai change nhi hona chahiye.
aaisa na ho iske liye
box-sizing: border-box;
border box ke karan padding ke hisab se width adjust krega apne aap ko
actual jo width hota hai usme added hota hai margin. so agr width fix krke hmlog
margin ya padding badhaye tb v width change hoga.
widhth: 544px;
UNIVERSAL SELECTOR= KOI V CHIZ JO SARE ITEMS KE LIYE ADD KRNA HAI
<style>
*{
box-sizing: border-box;
margin: 0;
padding: 0;
}
</style>
vs code trick
1)#fruits.item press enter
div#fruits.item press enter
this will fruit as id and item as class for this div.
<div id="fruits" class="item">
</div>
2) p#fruits.mango press enter
this will give fruits as id and mango as class for this para.
3) .sonal press enter
<div class="sonal"></div>
4)select lines that you want to copy press shift alt and down arrow key. entire
lines will be copied.
margin:auto;
/* left aur right me barabar margin chorega so centre me aajayega top se nhi
chorega margin*/
5) shift + alt + down arrow we can select lines that we want to duplicate press
these buttons
ul>li*5 press enter(VS CODE TRICK)
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<body>
<link rel="stylesheet" href="foat.css">
<ul>
<li>Home</li>
<li>About us</li>
<li>Team</li>
<li>contact us</li>
<li>Donate</li>
</ul>
ul{
background-color: aqua;
list-style-type: none; //bullet point will be removed.
}
li{
color: white;
padding: 10px 15px;
float: left; // after writing this we will see our website will be black.
}
now if we will change color of li as black. we will see everything will come in a
row. but where is that green color? for this in ul we will have to give border: 1px
solid red;
and remove float from li. as we remove float we will see li will come out of
ul.containtr bexome sort.
to remove this problem we will go in ul(container) and will write overflow: auto;
sometimes it happens that when we insert image it will go out of the container;
container may be a paragraph, ul, div or anything then use overflow: auto; in that
cotainer in css style.
jb v hm float krte hai parent me se overflow ho jata hai content.
p{
border: 1px solid red;
overflow: auto;
}
img{
float: right;
width: 100px;
}
clear: right; //kisi floated element ke right me nhi rh skte.
can be used in floated as well as non-floated element.
clear: both; //its means na ho left me rhega na right me.
<body>
<a href="" class="btn">Read more </a>
</body> link lgayega