How to set fancybox height and width identical?

Can I use max-width and min-width with position:fixed?

  • i am trying to create a dynamic layout with position:fixed but its seems that when i use position:fixed, min-width and max-width doesn't behave correctly. I know that when i set position:fixed the element (div) is taken out of the normal flow of the document. My question is, how can i make it work without Javascript or Jquery? if it possible. here is my HTML Code:  <div class="container">    <div class="leftbar"></div>    <div class="rightbox"></div>  </div> STYLE .container {     position:fixed;     min-width:1000px;     max-width:2000px;     height:600px; } .leftbar {     position:relative;     width:300px;     border: 2px solid red;     height:600px;     float:left; } .rightbox {     position:relative;     min-width:700px;     max-width:1700px;     border: 4px solid green;     height:600px;     margin-left:306px; }

  • Answer:

    You don't have to use min-width property. Instead simply try the width property since it is same as minimum width as you are specifying the max.

Santhosh Sundar at Quora Visit the source

Was this solution helpful to you?

Other answers

I’m not quite sure why you expect here. `min-width` and `max-width` work fine with `position:fixed` but your container is not styled in a way that it would expand or shrink depending on its containing block (i.e. width in `%` or `left` and `right` values). So it is just using the style you have assigned to it, which matches the total width or inner boxes.Note that the content of a box styled with `position:fixed` may not be reachable as the browser will not allow users to scroll to it (if it is outside of the viewport). May be you want to use `position:absolute` instead?As a side note, you may want to learn a few CSS basics as your styles show some lack of understanding of how layout works. This may help: http://css-101.orgFinally, when asking for help, it is a good idea to use a tool like http://codepen.io to show your problem/issue and make it easier for people to help you.Good luck!

Thierry Koblentz

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.