Cant make background image the right size in MVC

Hello, am working with MVC and bootstrap/razor pages and a shared layout page that shares the navbar.

Well, there are 8 other pages, and three of them must have a full background image that stays fixed no matter the zoom size or screen resolution; those pages have other text or images that needs to scroll up or down.

No matter what Ive tried so far the image resizes. The only way to make the image stick full screen is to use the <body background-image: (‘url:someimage.png’) position:fixed

with the image in the body tag its there, but doesnt size right and it should be in a div.

Question: how to make the background image in this SHARED index.cshtml file look clean and centered?

even tried this CSS Background Image Size Tutorial – How to Code a Full Page Background Image

I tried copying the source from a google home page/tab that had a fixed background image? this was perfect, but it would not display the image, any image no matter what I did. its as if there is some hidden “do not show any image” css entry in there?

thanks for any ideas

When you link to another sites images that’s called “hot-linking” and the server should prevent it. Which is great for normal people because it does not steal their bandwidth.

Right id agree; I just wanted the screen saver image to show, but also tried the images saved in the local Content folder, did f12 and made sure they are found, just will not display local images; or if it does the image will have padding on top and will not center right, not even close;

I’m old-fashioned and like to keep my viewport square. Sometimes that alters the look of a background image. The viewport and the background image need the same proportions, or the image is bigger than necessary, else the browser will make some adjustments. did you use a reset or normalize.css?

no havent used either. if this was just a plain web page its one thing but shared layout must have conflicts or?

but the viewport? not touched

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.