简体   繁体   中英

How to resize DIV element according to browser size?

So here's a project I'm doing for school:

http://graciousevents.co.uk/

The problem is when the browser is re-sized, the photo-gallery moves underneath each other and then the contact DIV gets pushed to the left.

How can I correct this so the contact div doesn't get pushed to the left.

A particular within the DIV selector, if you want strings to re-size with the browser, instead of pixels, use "em".

Ex. div{ font-size: x em }

Are you using percentages for the sizing? If you give the window a set size and use pixels when sizing everything should stay where it is when you resize the window.

BEFORE:

width: 10%;

AFTER:

width:500px;

Change CSS using width: 62.5714%; or Use Bootstrap CSS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM