By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,766 Members | 1,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,766 IT Pros & Developers. It's quick & easy.

mixed widths and positioning

P: n/a
I'm developing a restaurant's website.

http://www.tsmchughs.com/

My template has div#content then div#navigation, which contains an
unordered list of links. I have positioned div#navigation on the left
side using the following:

BODY {
margin-left: 9.6em;
}

#navigation {
position: absolute;
width: 9em;
height: 100%;
top: 0;
bottom: 0;
left: 0;
}

I'd like to add a graphic to div#navigation, a 140px wide gif file.
Have I painted myself into a corner? How can I place the image in
#navigation and be sure that there is adequate space for both the
image and the text links?

--
Brian
follow the directions in my address to email me

Jul 20 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Brian <us*****@julietremblay.com.invalid-remove-this-part> wrote in message news:<jkwsb.134066$275.396634@attbi_s53>...
I'd like to add a graphic to div#navigation, a 140px wide gif file.
Have I painted myself into a corner? How can I place the image in
#navigation and be sure that there is adequate space for both the
image and the text links?


You can just do:

<div id="navigation">

<img src="foo">

<ul> ...Text links... </ul>

</div>

You could get into trouble if 9em < 140 px, which depends on the user's settings.

Garmt.
Jul 20 '05 #2

P: n/a
Garmt de Vries wrote:
Brian <us*****@julietremblay.com.invalid-remove-this-part> wrote
in message news:<jkwsb.134066$275.396634@attbi_s53>...
I'd like to add a graphic to div#navigation, a 140px wide gif file.
Have I painted myself into a corner? How can I place the image in
#navigation and be sure that there is adequate space for both the
image and the text links?


You can just do:

<div id="navigation">

<img src="foo">

<ul> ...Text links... </ul>

</div>

You could get into trouble if 9em < 140 px, which depends on the user's settings.


One could try setting 'max-width: 9em' for the image which wouldn't
work everywhere (i.e. IE) but after all we rely on that in most of
the cases 9em would be greater than 140px.

--
Stanimir

Jul 20 '05 #3

P: n/a
Garmt de Vries wrote:
Brian <us*****@julietremblay.com.invalid-remove-this-part> wrote in
message news:<jkwsb.134066$275.396634@attbi_s53>...

I'd like to add a graphic to div#navigation, a 140px wide gif
file. Have I painted myself into a corner? How can I place the
image in #navigation and be sure that there is adequate space for
both the image and the text links?

You can just do:

<div id="navigation">

<img src="foo">

<ul> ...Text links... </ul>

</div>


That's what I have done. But the question is whether I can set an
appropriate width.
You could get into trouble if 9em < 140 px, which depends on the
user's settings.


Exactly. And it seems dangerous simply to hope that 9em < 140px.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #4

P: n/a
On Wed, 12 Nov 2003 20:01:19 GMT, Brian
<us*****@julietremblay.com.invalid-remove-this-part> wrote:
My template has div#content then div#navigation, which contains an
unordered list of links. I have positioned div#navigation on the left
side using the following:

BODY {
margin-left: 9.6em;
}

#navigation {
position: absolute;
width: 9em;
height: 100%;
top: 0;
bottom: 0;
left: 0;
}

I'd like to add a graphic to div#navigation, a 140px wide gif file.
Have I painted myself into a corner? How can I place the image in
#navigation and be sure that there is adequate space for both the
image and the text links?


Maybe you could float the navigation bar left rather than using absolute
positioning/margins, set the width in pixels and min-width in ems? That
should work for everyone except IE users who have set a larger font size
(and according to certain users of fixed pixel fonts, almost no IE users
know how to adjust their font size anyway ...)

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #5

P: n/a
In article Brian wrote:
I'm developing a restaurant's website.

http://www.tsmchughs.com/

My template has div#content then div#navigation, which contains an
unordered list of links. I have positioned div#navigation on the left
side using the following:
[snip]
I'd like to add a graphic to div#navigation, a 140px wide gif file.
On top, I assume. What height? If that it won't be taller than heading
on right, you could replace 10000000em with image height and still avoid
strange look and it would be less likely that it would broke something.
Have I painted myself into a corner?
Seems to. I can't think any neat and clean solution.
How can I place the image in
#navigation and be sure that there is adequate space for both the
image and the text links?


Kludge:

#navigation {min-width:140px}

<BODY ID="tsmchugh" style="margin-left:0;">
<div style="float:left;width:140px;margin-bottom:10000000em</div>
<DIV ID="content" style="margin-left:9em;">
...
<DIV CLASS="copyright" style="clear:none;">
I do not know if some browser displays white space created by too big
margin, it might cause long empty space. Partially tested on O7.22
I don't know if it is possible to get IE strech right bar to accommodate
image.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #6

P: n/a
Stephen Poley wrote:
On Wed, 12 Nov 2003 20:01:19 GMT, Brian wrote:
My template has div#content then div#navigation, which contains an
unordered list of links. I have positioned div#navigation on the left I'd like to add a graphic to div#navigation, a 140px wide gif file.
How can I place the image in
#navigation and be sure that there is adequate space for both the
image and the text links?
Maybe you could float the navigation bar left rather than using absolute
positioning/margins,


<sigh> Yeah, that's looking like my only option. Well, that or not
putting the logo together with the navigation, which seems like the
most logical place. To change it to float, though, I need to move the
navigation to the top of each html file.

I wonder if it's feasible to allow authors to suggest widths as
equations (width: 100% - 9em). Boy, that'd be nice. It'd also be
*years* down the road, if it is even possible.
set the width in pixels and min-width in ems? That
should work for everyone except IE users who have set a larger font size
(and according to certain users of fixed pixel fonts, almost no IE users
know how to adjust their font size anyway ...)


They do present some odd arguments. Regardless of adjusting their
font size, is it not possible for very different initial settings,
dependent on e.g. resolution?

--
Brian
follow the directions in my address to email me

Jul 20 '05 #7

P: n/a
In article Lauri Raittila wrote:
#navigation {min-width:140px} I don't know if it is possible to get IE strech right bar to accommodate
image.


But of course you can use bacground image that has 140px wide green area.

More elegant code would be putting logo before content and floating it
left instead of dummy div, and then adding it as fixed background image
to positioned sidebar. Or positioning sidebar bottom of logo absolutely
(fixed could not work.)

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #8

P: n/a
"Brian" <us*****@julietremblay.com.invalid-remove-this-part> a écrit
dans le message de news:iZ6tb.198728$Tr4.568169@attbi_s03...
I wonder if it's feasible to allow authors to suggest widths as
equations (width: 100% - 9em). Boy, that'd be nice. It'd also be
*years* down the road, if it is even possible.


I stongly support this point! I have the problem, that I want to
construct a absolute positioned navigation bar with an em width and px
borders. So, up to now, it seems impossible for me to absolutely
position the content box so that the edges are exactly aligned, because
I'd need sth. like
left: 20em+2px;

--
Andreas
To reply via e-mail, please remove the fruit and the ".invalid" top
level domain from my address.
Jul 20 '05 #9

P: n/a
"Brian" <us*****@julietremblay.com.invalid-remove-this-part> schrieb im
Newsbeitrag news:iZ6tb.198728$Tr4.568169@attbi_s03...
I wonder if it's feasible to allow authors to suggest widths as
equations (width: 100% - 9em). Boy, that'd be nice. It'd also be
*years* down the road, if it is even possible.


You've got the point. It would not only be nice but - in combination with
the W3C box model which makes it impossible to for example use a width of
100% with a padding or a border - it actually would be a must. That's my
problem with standards complying HTML/CSS: If an easy everyday task as
combining a logo with the rest of the page is such a big problem, the
standards seem to be not good enough.

--
Markus
Jul 20 '05 #10

P: n/a
"Stanimir Stamenkov" <s7****@netscape.net> schrieb im Newsbeitrag
news:bo*************@ID-207379.news.uni-berlin.de...
One could try setting 'max-width: 9em' for the image
That means resizing the logo which gives very bad display results with
graphics, specially logos.
but after all we rely on that in most of
the cases 9em would be greater than 140px.


I am not sure how an em is calculated; from the typographer's point of view
it should equal the font size. If you calculate 140px/9 you get a minimum
font size of 16 pixels which equals 12 points on 96ppi Windows monitors.
That matches quite a large part of the audience. On Mac systems which
calculate screen resolution of 72ppi you get a minimum font size of 16
points which will be greater than most user settings. So these users will
have a bad display.

That's just an approach as some browsers also handle font sizes differently.

--
Markus
Jul 20 '05 #11

P: n/a
Markus Ernst wrote:
"Stanimir Stamenkov" <s7****@netscape.net> schrieb im Newsbeitrag
news:bo*************@ID-207379.news.uni-berlin.de...
One could try setting 'max-width: 9em' for the image


That means resizing the logo which gives very bad display results with
graphics, specially logos.
but after all we rely on that in most of
the cases 9em would be greater than 140px.


I am not sure how an em is calculated; from the typographer's point of view
it should equal the font size. If you calculate 140px/9 you get a minimum
font size of 16 pixels which equals 12 points on 96ppi Windows monitors.
That matches quite a large part of the audience. On Mac systems which
calculate screen resolution of 72ppi you get a minimum font size of 16
points which will be greater than most user settings. So these users will
have a bad display.

That's just an approach as some browsers also handle font sizes differently.


For your convenience:

img.daImage {
width: 140px;
max-width: 9em;
}

Given the presumption that 9em > 140px on most user systems the
image won't scale larger than 140px therefore there would be no
distortion. When on a particular user system 9em become less than
140px the image will scale down but won't overflow the 9em width
menu container therefore won't cover any important part of the main
document.

--
Stanimir

Jul 20 '05 #12

P: n/a
"Stanimir Stamenkov" <s7****@netscape.net> schrieb im Newsbeitrag
news:bp*************@ID-207379.news.uni-berlin.de...

Given the presumption that 9em > 140px on most user systems the
image won't scale larger than 140px therefore there would be no
distortion. When on a particular user system 9em become less than
140px the image will scale down but won't overflow the 9em width
menu container therefore won't cover any important part of the main
document.


It depends a little on the image but scaling down usually produces bad
results, too. Specially on graphical stuff as type or logos. Imagine a 1
pixel black straight line. It will produce 2 lines of different grey next to
each other if scaled down. Some browsers may handle that better than others,
but there is no control.

--
Markus
Jul 20 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.