I am facing difficulties with CSS regarding the properties width
and margin
. I am developing a webpage that should display properly on all devices, including PCs, smartphones, and tablets. I am using HTML
<meta name="viewport" content="width=device-width, initial-scale=0" >
and using pixels (not automatic or percentage) as the unit for CSS.
Currently, when resizing the window on a PC browser, elements remain in their positions without any issues. However, on mobile devices such as smartphones and tablets, the layout appears different:
https://i.sstatic.net/ZXzyL.png https://i.sstatic.net/CnATW.png
Any comments or solutions to address this issue would be greatly appreciated. Thank you.
UPDATED CODE: The page is structured similar to the example shown here: https://jsfiddle.net/1wfr3vpq/. All classes that were originally set to "px" for properties like width:1024px;
or margin-left:150px;
have now been changed to "auto".