Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (20.3k points)

I have a div tag with a width set to 800 pixels. When the browser width is greater than 800 pixels, it shouldn't stretch the div, but it should bring it to the middle of the page.

1 Answer

0 votes
by (40.7k points)

Try using the code given below:

<body>

    <div style="width:800px; margin:0 auto;">

        centered content

    </div>

</body>

Browse Categories

...