user264341
user264341

Reputation: 157

CSS trick to adjust html element when window resize

I am going to develop a web page for Mobile. I need to resize window element with width of screen.Suppose I create a form with some text fields. It display fit when width of screen is wide. But if screen has long hight and less width then form element (text box,label etc) are overlapped or hide with few corner part.

How I can do like this if I resize screen to smaller then displaying HTML element should be smaller automatically to fit with screen size.

Please give your suggestions.

Thanks, Deepak

Upvotes: 0

Views: 897

Answers (2)

Simon Arnold
Simon Arnold

Reputation: 16177

I suggest you to use Percent dimensions and box-sizing: border-box;

Upvotes: 1

Zoltan Toth
Zoltan Toth

Reputation: 47687

The best solution is to use media queries

With them you can apply separate styles for different device widths and make sure that all your pages(and forms) look pretty on every screen.

That will also help to avoid distortion of the page or making the text unreadable small, which might occur when you'll try to squeeze a page designed for a wider screen to a narrow mobile device.

Upvotes: 2

Related Questions