Refresh the page and the h1 text should be centered now with relatively less space around it. So, we need to set the height of our body and HTML elements to 100%. When we set height or width in %, say 100% in our case, it’s not 100% of the screen - it’s 100% of its parent’s dimension. Let’s refresh the page in the browser and see the result.Īctually, we are missing one detail here. takes us one folder up in the folder structure. So we need to go one folder out and then reference the path. at the beginning of the path? See, we are referencing the image file which is in the "img" folder from our styles.css file which is in the "css" folder, right? Notice how we are referencing the image file: url("./img/infinity-war-wallpaper.jpg"). We set the background image using the “background-img” property. In our CSS file, we set the width and height to 100% so that it covers the entire screen. As you can see, we created a div and gave it a class in our HTML file.
0 Comments
Leave a Reply. |