Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

HTML website to fit 100% width

Featured Replies

Hi, i am a newbie to the webworld so this may sound like a silly question. What i am looking to do is create a few websites to help me learn and pick up skills as i go along. What i am looking to do is to create a HTML webpage that will cover the 100% width of the browser (any size screen) without any scrollbars but i am not too sure as to how i can start. I was thinking of having a table with the width of 100%, but i am not sure if this is the best or standard method.

 

If somebody could please guide me as to how i can do this.

 

Thanks in advance.

Don't use tables. Learn some CSS as it isn't so hard.

 

.wrapper {
  float: left;
  width: 100%;
}

 

in your CSS file will do the job.

Oh, I forgot to add this: If you want that div to have 100% width of the browser window don't forget to set padding and margin to 0 for html body

 

body {
 margin: 0;
 padding: 0;
}

If you want your page to fit any window resolution width you have to code all divs, side margins, side padding, images and all other elements in % to total 100%.

For images just code the width and then the height should adjust in proportion:-

<img style="width: 20%;" src="image.jpg" alt="description" />

 

Borders cannot be sized in % so if you have side borders in px make all the % total 97% or 98% to allow for the borders.

 

You may get a vertical scrollbar but should not get a horizontal one.

 

It can be difficult and may look odd when stretched to 1920px window resolution or squashed to say 500px width in a handheld device or a small window, in which case don't use % widths but use min-width and max-width in px for a page container but this won't work in IE6.

Since your starting out, why not search google for "Fluid CSS Layouts". There are many free layouts on the web for you to use, not templates, just layouts.

 

This will allow you to have a visual medium to learn the basics from quickly. You can then either attempt to make your own layout using the downloaded one as a guide, or simply adjust the downloaded one to suit your needs.

 

As already mentioned, Tables are to be used to display data in a table only. They should NOT be used for web-site layout. The very old method of designing sites did use tables, but that was considered redundant many years ago.

 

There are hundreds of resources out there to learn CSS. Good luck with your design and keep us posted how it goes :)

  • Author

Thanks for all your responses, really appreciate it. Wickham, would i be able to apply the same logic as the image to a flash file as well? Sorry just curious...

I don't know Flash coding but I expect you would have to code the width in % into the object and embed tags that contain the Flash url. Whether you have to code the % width inside the Flash file as well I don't know.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.