I can't get positioning, max-width and "right: 0px" to work together in harmony! I create a div that is fixed on my site in the upper right corner. The content of the page has a maximum width of 1000 pixels, but the label only obeys my "right: 0px" rule and sticks to the right before reaching the maximum maximum width. It should also be noted that by default the div is in the upper left corner and obeys max-width (if I type "left: 0px;", although it does not obey the rule and it adheres to the left).
CSS
#content { margin: 0 auto; max-width: 1000px; } #div { width: 150px; position: fixed; right: 0px; }
Here are a few alternatives that I have already tried:
- width: 100% (with text alignment: right) <--- not quite right, and I don't like 100% width, not 150 pixels
- adding code to place the div "manually" in html (not CSS)
- I found that float and text-align do not affect fixed positioning
Help is much appreciated! Thanks.
source share