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
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
Related Q & A:
- Can i use Shamir's secret sharing scheme for multiplicative homomorphism for secure multiparty computation?Best solution by Cryptography
- Can I use dual monitors?Best solution by Super User
- How can I use SSL with django?Best solution by Stack Overflow
- Can I use a photo of myself as my avatar? If so, how do I do it in Yahoo messenger?Best solution by Yahoo! Answers
- What products can I use if I have facial eczema?Best solution by everydayhealth.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.