Why does my site expand to fit the browser?
Hey,
I'm starting out with html and I think I'm making decent progress. But there is one stumbling block I can't seem to get over: when my site is viewed through a large browser window it expands to fill it, which means carefully lined up links and images end up going all over the place.
Now, I managed to stop it all shrinking down in a small browser by using a table, but the table itself still expands to fill the space. I've also noticed that this only happens on pages with paragraphs in them; I have some pages that are waiting for content and have nothing more than pictures and headings, these do not expand to fill space.
Does anybody know how to remedy this?
Thanks,
WS.
Megan posted this at 15:50 — 12th July 2010.
She has: 11,421 posts
Joined: Jun 1999
Hi Shelmerdine,
That's basically what HTML elements do if they don't have a width specified to contain them. Try writing a plain HTML page with some simple elements. Block-level elements (paragraphs, tables, lists etc.) will expand to fill the available space. Then try adding a width using CSS. This will constrain them to the width you specify.
Those headings should stretch - I'm guessing they're just not long enough to push the width wider.
You shouldn't use a table to try to correct the layout - use a
<div>
and give it a width using CSS.If you have any questions please feel free to ask. It might be helpful to post a link to what you have so far so we can see exactly what's happening.
Megan
Connect with us on Facebook!
Shelmerdine posted this at 16:25 — 12th July 2010.
They have: 4 posts
Joined: Jul 2010
Thanks Megan,
Sorry to sound thick, but what does a
<div>
element do?The website's http://www.ditsybags.co.uk/ All very basic at the moment, a work in progress.
Thanks again,
WS
checkwebsite posted this at 19:57 — 12th July 2010.
They have: 4 posts
Joined: Jul 2010
Check out here for explanation of html element
http://en.wikipedia.org/wiki/HTML_element
JeevesBond posted this at 05:00 — 13th July 2010.
He has: 3,956 posts
Joined: Jun 2002
Welcome to the Webmaster Forums!
Just a quick note: please don't use tables for laying out your pages! It's a method that's been dying since the nineties and doesn't seem to want to go away. Not complaining or having a go at you, just something to bear in mind.
Sorry to sound thick, but what does a
<div>
element do?We have an article about that, it's called What is a div?
Don't worry about sounding thick, you don't.
a Padded Cell our articles site!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.