|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="UTF-8"> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | + <title>Responsive Test</title> |
| 7 | + <style> |
| 8 | + body { |
| 9 | + margin: 0; |
| 10 | + padding: 20px; |
| 11 | + font-family: Arial, sans-serif; |
| 12 | + } |
| 13 | + |
| 14 | + .test-container { |
| 15 | + border: 2px solid red; |
| 16 | + background: rgba(255, 0, 0, 0.1); |
| 17 | + padding: 10px; |
| 18 | + margin: 10px 0; |
| 19 | + } |
| 20 | + |
| 21 | + .full-width { |
| 22 | + width: 100%; |
| 23 | + background: rgba(0, 255, 0, 0.1); |
| 24 | + border: 1px solid green; |
| 25 | + padding: 10px; |
| 26 | + } |
| 27 | + |
| 28 | + @media (max-width: 768px) { |
| 29 | + .mobile-info { |
| 30 | + display: block; |
| 31 | + background: yellow; |
| 32 | + padding: 10px; |
| 33 | + margin: 10px 0; |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + @media (min-width: 769px) { |
| 38 | + .mobile-info { |
| 39 | + display: none; |
| 40 | + } |
| 41 | + } |
| 42 | + </style> |
| 43 | +</head> |
| 44 | +<body> |
| 45 | + <div class="mobile-info"> |
| 46 | + <strong>Mobile view detected!</strong> Screen width is less than 768px. |
| 47 | + </div> |
| 48 | + |
| 49 | + <h1>Responsive Width Test</h1> |
| 50 | + |
| 51 | + <div class="test-container"> |
| 52 | + <h2>Container Test</h2> |
| 53 | + <p>This container should expand to full width on mobile devices.</p> |
| 54 | + <div class="full-width"> |
| 55 | + This div should be 100% width of its container. |
| 56 | + </div> |
| 57 | + </div> |
| 58 | + |
| 59 | + <div class="test-container" style="max-width: 90rem; margin: 0 auto;"> |
| 60 | + <h2>Max-Width Container (90rem)</h2> |
| 61 | + <p>This matches your site's max-width constraint.</p> |
| 62 | + <div class="full-width"> |
| 63 | + Full width within constrained container. |
| 64 | + </div> |
| 65 | + </div> |
| 66 | + |
| 67 | + <script> |
| 68 | + function updateScreenInfo() { |
| 69 | + const width = window.innerWidth; |
| 70 | + const height = window.innerHeight; |
| 71 | + document.title = `Responsive Test - ${width}x${height}`; |
| 72 | + |
| 73 | + const info = document.createElement('div'); |
| 74 | + info.style.position = 'fixed'; |
| 75 | + info.style.top = '0'; |
| 76 | + info.style.right = '0'; |
| 77 | + info.style.background = 'rgba(0,0,0,0.8)'; |
| 78 | + info.style.color = 'white'; |
| 79 | + info.style.padding = '10px'; |
| 80 | + info.style.fontSize = '12px'; |
| 81 | + info.style.zIndex = '9999'; |
| 82 | + info.innerHTML = `${width} x ${height}px`; |
| 83 | + |
| 84 | + // Remove previous info |
| 85 | + const prev = document.querySelector('.screen-info'); |
| 86 | + if (prev) prev.remove(); |
| 87 | + |
| 88 | + info.className = 'screen-info'; |
| 89 | + document.body.appendChild(info); |
| 90 | + } |
| 91 | + |
| 92 | + window.addEventListener('resize', updateScreenInfo); |
| 93 | + updateScreenInfo(); |
| 94 | + </script> |
| 95 | +</body> |
| 96 | +</html> |
0 commit comments