473,800 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the best approach?

Hi all,

I want to create a layout with a heading at the top and two columns below it,
with the left containing a menu, and the right containing the main content of
the page. I'd like the heading section to be as tall as it's content, the left
to be as wide as it's content, and the right to just fill the rest of the
screen. I don't want to use px sizes anywhere if possible, and even percentages
would be nice to avoid for the menu and content sections.

I can't find a decent explanation of positioning using absolute and relative, so
it's hard to understand why things appear where they do when I use certain
combinations. The use/terminology for position does not seem the least bit
intuitive.

Ideally I'd just like to specify the three sections and then put the content in
as below, but I think it doesn't work because the browser can't work out how big
or where to put the left and right bits in relation to the bits that have been
placed before them like the previous bits don't even exist yet. So they end up
simply overlapping.

#heading {
width: 100% <--- this is so I can get a bottom border going right across
}

#menu {
height: 100%; <--- this is so I can get a right border going to page bottom.
}

#content {
}

<div id=heading>
<h1>heading</h1>
</div>
<div id=menu>
<a href=home.html> home</a><br>
<a href=links.html >links</a><br>
<a href=about.html >about us</a>
</div>
<div id=content>
<h2>sub-heading</h2><br>
<p>Welcome to our home page, THE site for...</p>
</div>

Unfortunately stuffs just overlaps, and if I use position: relative for each
section, they just appear one after the other going down the page.

One site recommends creating two "rows", then one content div for the top row
and two content divs for the second row. They also also specify the column
widths for all, but I'd like to avoid that. Why do it that way? Something to do
with positioning no doubt.

Thanks for any help or links to good sites. I've tried ALA and glish.

--
Ben Thomas

Apparently less than 10% of accidents are caused by drivers exceeding the speed
limit.
Jul 20 '05 #1
14 2042
BenOne© wrote:
I want to create a layout with a heading at the top and two columns below it,
with the left containing a menu, and the right containing the main content of
the page. I'd like the heading section to be as tall as it's content, the left
to be as wide as it's content, and the right to just fill the rest of the
screen. I don't want to use px sizes anywhere if possible, and even percentages
would be nice to avoid for the menu and content sections.
Fairly straightforward .
#heading {
width: 100% <--- this is so I can get a bottom border going right across
}
Unnecessary, as block level elements such as <div> and <h1> take up all
the available width unless you write css to suggest otherwise.
#menu {
height: 100%; <--- this is so I can get a right border going to page bottom.
}
Seems ok, but note that various versions of IE/Win need different things
to accomplish what should be a simple task. :(
<div id=heading>
<h1>heading</h1>
</div>
<div id=menu>
<a href=home.html> home</a><br>
<a href=links.html >links</a><br>
<a href=about.html >about us</a>
</div>
<div id=content>
<h2>sub-heading</h2><br>
<p>Welcome to our home page, THE site for...</p>
</div>
Define a width for div#menu, in em units so it scales properly, and
float it left.
if I use position: relative for each section
As David Dorward stated in another thread: don't position if you don't
have to. With the html as you have it, you shouldn't need positioning.
One site recommends creating two "rows", then one content div for the top row
and two content divs for the second row. They also also specify the column
widths for all, but I'd like to avoid that. Why do it that way?
Table layout for your problem seems entirely unecessary, it's true.
Something to do with positioning no doubt.


No, float is the way. Very simple.

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #2
BenOne© wrote:
I want to create a layout with a heading at the top and two columns below it,
with the left containing a menu, and the right containing the main content of
the page. I'd like the heading section to be as tall as it's content, the left
to be as wide as it's content, and the right to just fill the rest of the
screen. I don't want to use px sizes anywhere if possible, and even percentages
would be nice to avoid for the menu and content sections.
Fairly straightforward .
#heading {
width: 100% <--- this is so I can get a bottom border going right across
}
Unnecessary, as block level elements such as <div> and <h1> take up all
the available width unless you write css to suggest otherwise.
#menu {
height: 100%; <--- this is so I can get a right border going to page bottom.
}
Seems ok, but note that various versions of IE/Win need different things
to accomplish what should be a simple task. :(
<div id=heading>
<h1>heading</h1>
</div>
<div id=menu>
<a href=home.html> home</a><br>
<a href=links.html >links</a><br>
<a href=about.html >about us</a>
</div>
<div id=content>
<h2>sub-heading</h2><br>
<p>Welcome to our home page, THE site for...</p>
</div>
Define a width for div#menu, in em units so it scales properly, and
float it left.
if I use position: relative for each section
As David Dorward stated in another thread: don't position if you don't
have to. With the html as you have it, you shouldn't need positioning.
One site recommends creating two "rows", then one content div for the top row
and two content divs for the second row. They also also specify the column
widths for all, but I'd like to avoid that. Why do it that way?
Table layout for your problem seems entirely unecessary, it's true.
Something to do with positioning no doubt.


No, float is the way. Very simple.

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #3

"BenOne©" <no**@m.thanks. mate> wrote in message
news:or******** ***@192.168.11. 2...
Hi all,

I want to create a layout with a heading at the top and two columns below it, with the left containing a menu, and the right containing the main content of the page. I'd like the heading section to be as tall as it's content, the left to be as wide as it's content, and the right to just fill the rest of the
screen. I don't want to use px sizes anywhere if possible, and even percentages would be nice to avoid for the menu and content sections.


Hello,

http://nemesis1.f2o.org/templates.php

Some good layout examples can be found here. A google search for CSS layouts
will yield lots of results.

Regards,
Jim Roberts
Jul 20 '05 #4

"BenOne©" <no**@m.thanks. mate> wrote in message
news:or******** ***@192.168.11. 2...
Hi all,

I want to create a layout with a heading at the top and two columns below it, with the left containing a menu, and the right containing the main content of the page. I'd like the heading section to be as tall as it's content, the left to be as wide as it's content, and the right to just fill the rest of the
screen. I don't want to use px sizes anywhere if possible, and even percentages would be nice to avoid for the menu and content sections.


Hello,

http://nemesis1.f2o.org/templates.php

Some good layout examples can be found here. A google search for CSS layouts
will yield lots of results.

Regards,
Jim Roberts
Jul 20 '05 #5
In article <10************ *@corp.supernew s.com>, Brian writes:
#heading {
width: 100% <--- this is so I can get a bottom border going right across
}


Unnecessary, as block level elements such as <div> and <h1> take up all
the available width unless you write css to suggest otherwise.


I've found this out to my dismay. What (if any) would one write to
recommend "I want this block-level element to be no wider than its
content"?

--
Michael F. Stemper
#include <Standard_Discl aimer>
It's Ensign Schrodinger! He's half-dead, Jim!

Jul 20 '05 #6
In article <10************ *@corp.supernew s.com>, Brian writes:
#heading {
width: 100% <--- this is so I can get a bottom border going right across
}


Unnecessary, as block level elements such as <div> and <h1> take up all
the available width unless you write css to suggest otherwise.


I've found this out to my dismay. What (if any) would one write to
recommend "I want this block-level element to be no wider than its
content"?

--
Michael F. Stemper
#include <Standard_Discl aimer>
It's Ensign Schrodinger! He's half-dead, Jim!

Jul 20 '05 #7
Michael Stemper wrote:
What (if any) would one write to recommend "I want this block-level
element to be no wider than its content"?


display: table-cell;

Works in Opera 7+ (not sure about < 7).
Does not work in MSIE/Win.
Not sure about other browsers.

Or, you can float it without specifying a width. According to CSS2, the
element should still take 100% width. But many browsers ignored this,
and made width only as wide as necessary. If you take this route, be
careful with flow of elements that follow.

Works in MSIE/Win 5+ (I think).
Works in Opera.
Works in Mozilla.

Does not work in MSIE 5.x/Mac.

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #8
Michael Stemper wrote:
What (if any) would one write to recommend "I want this block-level
element to be no wider than its content"?


display: table-cell;

Works in Opera 7+ (not sure about < 7).
Does not work in MSIE/Win.
Not sure about other browsers.

Or, you can float it without specifying a width. According to CSS2, the
element should still take 100% width. But many browsers ignored this,
and made width only as wide as necessary. If you take this route, be
careful with flow of elements that follow.

Works in MSIE/Win 5+ (I think).
Works in Opera.
Works in Mozilla.

Does not work in MSIE 5.x/Mac.

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #9
On Wed, 21 Apr 2004 12:16:05 -0500, Michael Stemper
<ms******@sieme ns-emis.com> wrote:
In article <10************ *@corp.supernew s.com>, Brian writes:
#heading {
width: 100% <--- this is so I can get a bottom border going right
across
}


Unnecessary, as block level elements such as <div> and <h1> take up all
the available width unless you write css to suggest otherwise.


I've found this out to my dismay. What (if any) would one write to
recommend "I want this block-level element to be no wider than its
content"?


h1 {display: inline;}

or

h1 {float: left;}

.... of course you have to make sure in some other way that line-breaks are
available were needed, for example by properly wrapping paragraphs of text
in <p> </p> tags.

Newish, and not as well supported:

h1 {display: inline-block;}

--
Rijk van Geijtenbeek

The Web is a procrastination apparatus:
It can absorb as much time as is required to ensure that you
won't get any real work done. - J.Nielsen
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3843
by: Navin | last post by:
HI, Guys There has been a lot of Ways to use paging in asp 1>Recordset approach -where whole records are pulled at client side... and then only the records which are needed are filtered.. and now that is not the approach good as we are pulling unnesscary all the 10,000 say for dispalying 100 records...if pagesize is 100 2>i have seen is the Stored procedure approach where data is inserted
7
1892
by: Hostile17 | last post by:
I'm trying to arrive at a kind of "industry standard" or "best practice" approach to CSS for a policy document aimed at developers, but not necessarily very experienced developers. What does the CIWAS community think is the best way to go about styling documents for maximum compatibility/minimum problems with old browsers. We have a range of people currently using a range of techniques, i.e.
3
2002
by: Chris Transcend | last post by:
Hi all, I'm writing my first .NET website and am wondering what the best method for including headers and footers is. I was thinking either a user or server control but am not sure which would be best performance-wise / maintenance wise. OR if there is another approach that is more commonly followed. I'm interested in performance mainly, but not at the expense of being able to maintain the headers within reason. I'm coming from the...
1
1744
by: Andy Britcliffe | last post by:
Hi I'm faced with the situation where I could have a single physical file that could contain multiplie XML documents e.g file.txt contains the following: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE doc SYSTEM "1.0b.dtd"> <doc transmission-date="20050715T154340Z" >
16
1915
by: LP | last post by:
Hi, Every morning a .NET application downloads a file with cumulative data which needs to be appended to SQL Server table. This program needs to identify records that have not been previously inserted (there's a unique identifier field) and only insert those. Also I must reuse our class that does updates, it basically can update any table by using SqlDataAdapter .update method. So I have to rule out bulk inserts, DTS, etc... I think I...
8
3192
by: Midnight Java Junkie | last post by:
Dear Colleagues: I feel that the dumbest questions are those that are never asked. I have been given the opportunity to get into .NET. Our organization has a subscription with Microsoft that basically entitled to us to just about every .Net development tool you can imagine. I cant even begin to mention them. To begin with, my background is not that of a programmer, but a systems engineer and the closest I have come to "programming"...
2
1293
by: Andrew | last post by:
Hello, friends, I implemented Forms Authentication in my asp.net app, it worked fine. However, now I have another problem: Although a user can be authenticated, but he/she may still not be allowed to view certain pages and folders. For exampl, a junior member can not view pages for senior memebers, although he/she can log into the web site. <authorization> in web.config seems a good approach. However, it needs
4
1292
by: Jeff | last post by:
Hey ASP.NET 2.0 I'm about to create a UserControl for my web project, but I'm wondering if I need to create 2 UserControls instead. Because these UserControls will be very similar, the only difference between them will be that one of these UserControls are containing a control (also being a UserControl, lets call it "A"), which the other UserControl don't contain!
6
3124
by: bill | last post by:
I am about to start on a module that will accept a location from a user, use Google geolocation services to get the lat/lon and then compute the distance from the site visitor to about 100 kennels (could grow to 1000 eventually). Once I have the distance I need to sort the kennels by distance and present those within 500 miles. Approach 1: read the kennel lat/lon from the mysql kennel record compute the distance
184
7132
by: jim | last post by:
In a thread about wrapping .Net applications using Thinstall and Xenocode, it was pointed out that there may be better programming languages/IDEs to use for the purpose of creating standalone, single executable apps. My goal is to create desktop applications for use on Windows XP+ OSs that are distributed as single executables that do not require traditional install packages to run. I would like to use a drag and drop UI development...
0
10276
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9090
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7580
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.