| <!DOCTYPE html> | |
| <!-- | |
| | When absolutely positioned elements have both left and right set to non-auto, | |
| | the element's width should be determined by them. | |
| --> | |
| <html> | |
| <head> | |
| <style> | |
| body { | |
| margin: 0; | |
| } | |
| .outer-absolute-block { | |
| position: absolute; | |
| width: 300px; | |
| height: 300px; | |
| background-color: rgb(255, 100, 100); | |
| } | |
| .inner-absolute-block { | |
| position: absolute; | |
| height: 50px; | |
| left: 100px; | |
| right: 100px; | |
| top: 0px; | |
| background-color: rgb(100, 100, 255); | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="outer-absolute-block"> | |
| <div class="inner-absolute-block"></div> | |
| </div> | |
| </body> | |
| </html> |