Problems using max-width on div

Total Post:104


 1300  View(s)
Rate this:
I have a div which I'd like to remain at 960px when a browser window is scaled accordingly and up to 1100px when more screen real estate is available.

I tried using min-width:960px and max-width:1100px . All browsers seem to recognize the min-width but not the max. I actually tried it with each alone and 

using max the div just became hidden.

I'm not sure if any of my other rules affect the code but this is what i have

#div {
       background-image: url(../images/trans_bkg.png);
       background-repeat: repeat;
Hopefully you understand what I'm trying to accomplish with the code but I can provide a screenshot if that would help.

  1. Re: Problems using max-width on div

    Hi Marcel!

    try this way!

    @media (max-width: 1200px) {

    If the resolution is 1200px, the div's width will be 1100px.

    Similarly you can write it for a range

    @media (min-width: 680px) and (max-width: 1199px) {

      Modified On Mar-29-2018 11:37:45 PM


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.