---
title: "Problems using max-width on div"  
description: "Problems using max-width on div"  
author: "marcel ethan"  
published: 2013-04-05  
updated: 2013-04-05  
canonical: https://www.mindstick.com/forum/716/problems-using-max-width-on-div  
category: "css-css3"  
tags: ["css-css3"]  
reading_time: 1 minute  

---

# Problems using max-width on div

I have a div which I'd like to remain at 960px when a [browser](https://www.mindstick.com/blog/155254/which-is-the-best-internet-browser) [window](https://www.mindstick.com/forum/161285/how-does-the-window-console-object-work-in-javascript) is scaled accordingly and up to 1100px when more [screen](https://www.mindstick.com/forum/33644/loading-screen-during-ajax-call) [real estate](https://www.mindstick.com/articles/65351/how-asset-based-lending-works-for-real-estate-a-guide) 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 { min-width:960px; max-width:1100px; height:550px; [margin](https://answers.mindstick.com/qa/104990/what-is-a-margin-call)-top:10px; [background](https://www.mindstick.com/articles/65/how-to-change-background-color-of-tab-control-in-c-sharp)-image: url(../[images](https://www.mindstick.com/interview/1067/what-is-the-php-predefined-variable-that-tells-the-what-type-of-images-that-php-support)/trans_bkg.png); background-[repeat](https://www.mindstick.com/forum/156775/give-an-example-of-the-linq-repeat-method): repeat; position:[absolute](https://www.mindstick.com/interview/1159/what-is-absolute-and-sliding-expiration-in-dot-net); right:10px;}Hopefully you understand what I'm [trying](https://answers.mindstick.com/qa/93698/6-mistakes-couples-are-trying-to-save-money) to accomplish with the code but I can provide a screenshot if that would help.\
Thanks

## Replies

### Reply by AVADHESH PATEL

Hi Marcel!\
try this way!\

```
@media (max-width: 1200px) {div{  width:1100px;}}
```

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) {div{  width:1100px;}}
```


---

Original Source: https://www.mindstick.com/forum/716/problems-using-max-width-on-div

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
