How to Set Background Image In Html | How to add background image in css | Background-image: url path | Html Background | The ACX
HTML Background Images
Ex.
<div style="background-image: url('(photo name).jpg');">
Also We Can Use <style>
element for background image, in the <head>
section:-
Ex.
<style>
div {
background-image: url('(photo name).jpg');
}
</style>
Background Cover
If you want the background image to cover the entire element then, you can set the background-size
property to cover.
Also, Set the element is always covered and set the background-attachment property to fixed:-
Ex.
<style>
body {
background-image: url('(photo name).jpg');
background-size: cover;
background-attachment: fixed;
background-repeat: no-repeat;
}
</style>
Comments
Post a Comment