r/HTML • u/Eulevonathen • Oct 11 '26
Question Difference in screen size
Hello. I've created a website using HTML, CSS, and JavaScript for the first time. My problem is this: I wrote the code on a computer and adjusted the sizes to fit the large screen. Now, on my laptop, which has a smaller screen, everything is misaligned. Can you tell me how to fix this problem?
Thank you very much
3
Upvotes
View all comments
1
u/Reasonable-Pay-8771 Oct 16 '26
One approach to consider *before* resorting to media queries and laying out multiple formats is: remove all your hardcoded sizes and: use fractions of the screen size for big things and use normalized units or relative increases/decreases for small sizes and: use as much semantic html as you can instead of divs which carry no intrinsic meaning.
Does that make sense? If you don't start by building it to a particular size but arrange everything in a proper hierarchy (maybe with flexboxes and such) then it will be more responsive without hardcoding even more particular sizes for different phone dimensions etc.