| <!DOCTYPE html> | |
| <!-- | |
| | Absolutely positioned elements should use their containing block and not | |
| | their parent when resolving percentage values. | |
| --> | |
| <html> | |
| <head> | |
| <style> | |
| .container-block { | |
| position: absolute; | |
| width: 350px; | |
| height: 350px; | |
| background-color: rgb(255, 50, 50); | |
| } | |
| .static-block1 { | |
| position: static; | |
| width: 30%; | |
| height: 30%; | |
| background-color: rgb(0, 100, 255); | |
| } | |
| .absolute-block { | |
| position: absolute; | |
| width: 30%; | |
| height: 30%; | |
| background-color: rgb(0, 255, 100); | |
| transform: translateX(125px); | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container-block"> | |
| <div class="static-block1"> | |
| <div class="absolute-block"> | |
| </div> | |
| </div> | |
| </body> | |
| </html> |