'How to stop centering a div as soon as it hits the edge of the screen

i want to create a flexible layout, but I have one div which has to have a fixed width of 1000px. the best solution i had was to center the div while there was enough space available but when the screen became 1000px or smaller in width, the div would float:left. I'm aware that I could do this using media queries, but im already using those for different dimensions right now and wanted to explore other options. Does anybody have any suggestions?



Solution 1:[1]

You're pretty much left with media queries or using some JavaScript. Media queries are really the best approach for this due to performance and their declarative nature.

Solution 2:[2]

You should make it responsive and that would be with media queries or in your css, you should set the size in percentage for it to adapt with the user interface size. Simply make it responsive

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Jam Dizon