1 // change background color for specific id ..
2function changebackground(){
3 document.getElementById('id').style.backgroundColor = 'green' ;
4}
5// change background color for whole body..
6function changebackground(){
7 document.body.style.backgroundColor = 'green';
8}
9
1<!-- Code by Scratchy -->
2<!-- Twitter: @S_cratchy-->
3
4<head>
5 <style>
6 body {
7 background-image: url(https://wallup.net/wp-content/uploads/2019/09/110394-cats-grey-kittens-fluffy-fat-grass-animals-cat-kitten-baby-cute-748x468.jpg)
8 }
9 </style>
10
11 <body>
12 You have set the background image!
13
14
15
16 </body>
1/* Use the following code: */
2html {background-color: #fefefe;}
3/* You can change the hexedecimal code to RGB, RGBA, name & more colors!*/
1.my-div{
2 background-color: #00f; /* Blue */
3}
4.div-image{
5 background-image: url("Image Path");
6 background-position:
7 top right | left center | bottom center
8 top left | right center | bottom right
9 top center | center center | bottom left ;
10 /* Use any option that met your requirements*/
11 background-size: cover; /* Set the image to cover all the div */
12 background-repeat: no-repeat; /* Commonly used for that situation */
13 background-attachment: fixed; /* the image will stay with you while scrolling same as position: fixed*/
14 /* Use background-attachment: scroll [Default Value]; to remove fixed effect */
15}
16/*
17 Background shortHand
18 background: background-color background-image background-repeat background-position
19*/