<style>
selector{
property:value
}
</style>
<!-- this will allow the div to have a red background, and a black margin of 10px thick -->
<div
style = "background:red; margin:10px black">
</div>
<link
rel="stylesheet" type = "text/css" href = "index.css" >
</link>
/*for the tag*/
button{
color:red;
/* all the elements with button tags have their text colour red */
}
/*for id*/
#titles{
background:purple;
//all elements with " id = 'titles' " have purple background
}
/* for classes */
.card{
width:100%;
/* all elements with " class = 'card' " have a width of 100% of its parent's element */
}
/* when users hover a specific element: */
.card:hover{
background:purple
/* the elements with the class 'card' will have their backgrounds changed to purple */
}
/* this is a CSS comment */
#random{
//the width is 50px
//this is how you change your width
width:50px;
//the height is 50px
//this is how you change your height
height:50px;
//the background colour is red
//this is how you change your background colour
background:red;
}
This is the expected output:
#textDemo{
//font size is 30px
//this is how you change your text size
font-size:30px;
//the text is aligned to the left
//this is how you align your text
text-align:left;
//the text colour is revealed
//this is how you change your text colour
color:red
}
This is the expected output:
#div1{
color:purple
}
#div2{
//by name of colour
background : blue
}
#div3{
//the colour's hexadecimal value
background: #8C811E
}
#div4{
//the colour's rgb value
//rgba(red,green, blue)
background: rgb(0, 0, 0)
}
#div5{
//the colours' rgba value
//rgba(red,green, blue, alpha/opacity)
background: rgba(255,0,0,0.3)
}
This is the expected output:
#woPadding{
width:200px;
height:200px;
background:purple;
color:white;
}
#wPadding{
width:200px;
height:200px;
background:red;
color:white;
//spacing of 10px from content on each side
padding:10px;
}
Below is the expected output:
#woBorder{
width:200px;
height:200px;
background:purple;
color:white;
}
#wBorder{
width:200px;
height:200px;
background:red;
color:white;
border:5px blue solid;
}
#wBorderRadius{
width:200px;
height:200px;
background:black;
color:white;
border:5px purple solid;
//allows rounded corners for elements
border-radius:15px
// read more about border-radius here.
}
Below is the expected output:
<!-- in your 'head' tag -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We"
crossorigin="anonymous">
<!-- right before your closing 'body' tag -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj"
crossorigin="anonymous">
< script >
And you can use the Bootstrap components!