D
dorayme
richard said:dorayme said:Newbie wrote:A couple of improvements for you since my last. To promote... Can somebody please
take a look and tell me how to center the menus in the middle of the
page.
http://www.parcsystems.com/newsite/dropdownmenutest.html
....
fluidity, namely to allow the menu items to wrap on smaller
browser widths, perhaps use a percentage width instead of ems.
This will involve making a small further provision so the items
separate vertically when they wrap. Also, forget overflow, put a
clear in the style on the second UL.
Here is the adapted CSS, that might be something you find useful
or something you can adapt to suit your needs:
body {font-size: 100%;}
.sddm {
margin: auto;
width: 80%; /*crucial width guess */
padding: 0;
z-index: 30;
}
.sddm li {
margin: .2em 0 .2em 0;
padding: 0;
list-style: none;
float: left;
font: bold .85em Arial sans-serif;
/* Dont use px for font sizes and especially not flyspeck like
9px! */
}
[Don't forget to change all the hashes to dots in the rest.
remember, we are going class for reasons I explained before.
Notice too in the above the addition of the generic font,
sans-serif. Best to add in case you prefer the user not to use a
serif if they happen not to have Arial!]
And the HTML changes:
<!--Menu Table-->
<ul class="sddm">
<li><a href="#">Login</a></li>
<li><a href="#">Sign Up</a></li>
</ul>
<ul class="sddm" style="padding-top: .5em; clear: both;">
<li><a href
...
All good except for one thing. The script is looking for an ID!
In the UL, you could have <ul id="sddm1"> and <ul id="sddm2">
I was ignoring js requirements, leaving them to you, just demoing
a way to get your centring as far as the HTML and CSS were
concerned.
You can put put IDs (for the js) in as well as classes (for the
CSS), but just remember to have them unique, one per doc in the
HTML.
If you have different IDs and avoid multiple sames *and do
without* classes, then you can still centre but you would need to
alter the css a bit to catch more than one ID. You have two ULs
and if each has its own ID, simple to understand is to put in my
above CSS twice, once for the one ID and again for the other. Or
use construction like
#sddm1, #sddm2 {
margin: auto;
width: 80%;
....
}
....
and, of course, in the HTML, identify the ULs by their IDs.