Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / October 2004



Tip: Looking for answers? Try searching our database.

Two simple questions about divs and css

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
trialanderror - 29 Oct 2004 14:19 GMT
Both of these apply to using IE 6.0 or Netscape 7.x:

First question:

I am trying to set up a simple horizontal menu as a red strip across
the browser window.  Here is the relevant part of the css I'm using:

.menu {
    text-align: center;
    display: block;
    height: 1.5em;
    margin-bottom: 2em;
    background-color: #f00;
    }

.menuitem {
    background-color: inherit;
    color: #fff;
    padding-top: .75em;
    padding-bottom: .75em;
    width: 24.7%;
    float: left;
    font-size: 85%;
    font-weight: bold;
    vertical-align: 50%;
    }

And here is the relevant html:

<div class="menu">
<div class="menuitem">
<a href="item1.html">item1</a>
</div>
<div class="menuitem">
<a href="item2.html">item2</a>
</div>
<div class="menuitem">
<a href="item3.html">item3</a>
</div>
<div class="menuitem">
<a href="item4.html">item4</a>
</div>
</div>

This works as I'd like.  BUT... when I change the .menuitem width
percentages from 24.7 to 25, when I resize the browser window, there
are certain brief points where the item4 menu item wraps to the line
below before going up to the same line as everything else again.  99%
of the time, the menu looks fine (even if I shrink the browser window
to be really narrow, like 200 pixels wide).  Why though, with 25%
menuitem width, does the last item wrap at certain specific window
widths?

==============================================

Second question:

I would like to have some text centered within a blue-colored box that
is itself horizontally centered in the window.  And I'd like the box
to be no wider than the widest part of the text.

Using a single-cell table, this is easy to accomplish.  The table cell
is no wider than the widest point of the text, and centering the text
within the cell, and the table within the browser window, works great.

Using css, I can't come close.  Either the blue box goes all the way
across the screen, or isn't centered, or is too wide or too narrow.

I'm obviously missing something; this should be simple to do.  How?
Spartanicus - 29 Oct 2004 14:55 GMT
>I am trying to set up a simple horizontal menu as a red strip across
>the browser window.  Here is the relevant part of the css I'm using:

Don't post code to the group, upload it and supply the url:
http://www.spartanicus.utvinternet.ie/help_us_help_you.htm

Signature

Spartanicus

bill drescher - 30 Oct 2004 11:30 GMT
>>I am trying to set up a simple horizontal menu as a red strip across
>>the browser window.  Here is the relevant part of the css I'm using:
>
> Don't post code to the group, upload it and supply the url:
> http://www.spartanicus.utvinternet.ie/help_us_help_you.htm

Not a truly useful reply, I fear.

Signature

Bill Drescher
william {at} TechServSys {dot} com

brucie - 30 Oct 2004 11:51 GMT
In comp.infosystems.www.authoring.stylesheets  bill drescher said:

>> Don't post code to the group, upload it and supply the url:
>> http://www.spartanicus.utvinternet.ie/help_us_help_you.htm

> Not a truly useful reply, I fear.

its very useful, you now know why no one has helped you.

Signature

v   o   i   c   e   s     o  f     t  h  e     l  i  t  t  l  e

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.