Jump to content

Recommended Posts

Not sure if this fits here on CSS or under HTML, but chose to place it here as I reckon it is some CSS magic formula. If you go to www.koozai.com you will see the image at the top of the page (background image?). No matter what resolution I use, or what size browser it is, the image follows in scaling, is just as sharp and clear, is just as detailed and shows the same thing. How do they do it?

Link to comment
https://forums.phpfreaks.com/topic/315004-picture-scaling-background/
Share on other sites

If you're talking about the page background with the logo on the wall and the lamp; it's set up in the CSS using media queries. Inspect the element and resize the browser window; you'll see it's serving different images at different browser widths - this is a common practice in modern web development.

I see the possibilities and benefits of using that way to do it as well, but that is not what is directly done in the example I am referring to, or ....?
I also got a tip from another that I can use CSS background property and I could use flexbox as well. But those answers were so short so I think there
are a lot of not told, or information falling out. But as I see it, both three ways (😜) got their benefits. 'Maybe it depends on how I use them?
I say both three ways (to be a little ironic) because I am sure there is more than one way to handle this, but what is the best way depending
on whom told you to use which? OR am I totally wrong?

2 hours ago, LeonLatex said:

but that is not what is directly done in the example I am referring to, or ....?

I'd suggest spending some time learning how to use the developer tools so you can look at something like this and see how it's being done.  In this case, assuming there's not some mis-understanding to what you're referring, it's simply three things:

  1. Multiple versions of the background image served with @media rules.  This allows for crisp images at various screen sizes.
  2. Telling the browser to make the background image fit the element exactly by using background-size: cover
  3. Applying the background image to an element that is the size of the browsers view port and positioned below the rest of the page content.  See position: fixed, vh/vw units, z-index / stacking contexts.

 

I''m pretty sure there was no information falling out - the person you were talking to was more than likely talking about at least two completely separate things. Flexbox has nothing at all to do with backgrounds; it's a two-dimensional layout system.

Browser CSS support has gotten strong enough that CSS can do a lot of things these days (certainly much more than it could even just a short few years ago) and those things can affect pretty much every aspect of a page. Take some time to learn the basics. Even if you're a dedicated back-end developer working with a dedicated front-end developer, knowing how a page is structured and what can be done with that structure can help you determine how to collate and present to the front-end the data you pull from the back-end.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.