t1mp4
t1mp4
Explore posts from servers
KPCKevin Powell - Community
Created by t1mp4 on 6/20/2024 in #front-end
Weird layout shift with max-width
I have this dead simple code: https://codepen.io/t1mp4/pen/abrYzpN Why does the horizontal position of the body change when I replace the image with text? The shift is subtle but noticeable and weird. I have only tried it in Brave Browser (Chromium-based) and Firefox. For some reason, the layout doesn't change in Firefox, only in Brave. When I change the image height to some other value, say 100px, the layout shift is gone for some reason. I'm confused.
4 replies
KPCKevin Powell - Community
Created by t1mp4 on 10/18/2023 in #front-end
Make div "behave" like body element
Considering this simple HTML:
<html>
<head>
<title>My website</title>
</head>
<body>
<div id="app-root"></div>
</body>
</html>
<html>
<head>
<title>My website</title>
</head>
<body>
<div id="app-root"></div>
</body>
</html>
What is the best way to make the #app-root div "behave" like the <body> element? For example, if I set background-color: red; on the <body> element, the page obviously becomes red. But if I do the same to #app-root nothing happens (obviously) because there's no content inside of it. But I want #app-root to behave like the <body> element.
28 replies