Hi everyone. I’m new to coding world. Currently studying Web Development Career Path for a few months and in the meantime re-creating my personal website. It also helps me to practice what I’ve learned so far. However I got some problems that I can’t solve on my own.
I’ve created a homepage and two index content pages so far. But I can’t manage to fix the background image. The proportion of the image changes on every page. Here’s the CSS code I wrote:
background-image: url("file:///C:/Users/Rumeysa/Documents/VS Code Projects/rumeysagelgi.com/resources/jpegs/8.jpg");
Besides that I styled the h4 element as a box to include text content. I want to set the text box to proper dimensions and make it scroll when the text is longer than the box can cover. Here is current code:
font-family: 'Amiri', serif;
border: 10px groove rgb(239, 230, 250);
I upload a few screenshots for better understanding. I want background image to look like as on the first screenshot. I really would appreciate help from experienced developers. Thank you.
Hi there, welcome to the forums.
It’s a little difficult without the full codebase to look at (and test), but…
I think this is because you’re setting the
background properties of the
html element will be, effectively, the entirety of the rendered document. In the screenshots of your
whatIsWS.html page, your text is not contained within the dimensions of the window since you have to scroll down. As a result, your
html element is larger on that page than it is for your
homePage.html page and so the rendered background image is also larger - resulting in the differences you’re seeing.
You could work around that by using CSS to limit the size of your
This would set the dimensions of the HTML
body to match the window size. If you then set the background image against the
body, rather than
html, it should remain constant between pages.
I’m guessing that your text content is already wrapped in another element? If so, all you’d need to do would be to set the
width properties for it. I’d also possibly change the
overflow rule to
overflow-y, so that it only scrolls along the vertical and not both axes.
Not sure how much more help I can be without visibility of the markup, but this hopefully will get you in the right direction at least.