CSS - Css Horiz Ul Li Menu Nav Questions?
I'm trying to use a CSS horizontal menu. I created the menu nav in photoshop that uses a gradient background the spans horizontally across the screen, special images for bullets and special images for menu link dividers.
I'm using a div for the nav and using a slice of the gradient for the background which is fine. For the bullets and using the sliced image for the bullets which is fine. My problem is the text. I want to use a special font that is in my photoshop (its like Arial but the letters are fatter). Its not a web save font. Should I make the nav into images so my text is what I want it? I have heard something about dynamic fonts but I think thats too complicated for me. Is it so bad to use menu images with proper alt tags for the main navigation? Or should I just find a default windows font and hope the user has it? Also can I use ANY windows default fonts? Suggestions? Thanks Matt Similar TutorialsI have a CSS tabbed menu that shows horizontal in FF and Google Chrome (not sure about others at this point), but in IE7, it shows as vertical. I've checked the CSS & HTML in the W3C validators and come back with no errors, so I'm not sure why I'm having this problem. Any suggestions you could offer would be appreciated. CSS: Code: body { background-color: #5D5D5D; text-align: center; font-family: Arial, Helvetica, sans-serif; font-size: 0.8em; } /* Layout Specs */ #container { width: 950px; margin: 0 auto; text-align: left; } h1, h2, h3, p { margin: 10px 255px 10px 15px; } div.logo { text-align: left; } div.content { position: absolute; background-color: #FFFFFF; color: #504E52; width: 950px; margin: 0px 255px 0px 0px; z-index: 1; } div.header { background-image: url('images/header.png'); background-position: top; background-repeat: no-repeat; margin: 0px 0px 0px 0px; padding: 0px; width: 950px; height: 200px; z-index: 2; clear: both; } div.rtcol { position: relative; float: right; width: 235px; background-color: #E7EEF9; color: #504E52; border-left: 1px solid #7BD5EA; z-index: 2; } p.rtcol { margin: 0px; padding: 0px; } /* Tab Menu */ ol#menu { height: 2em; list-style: none; float: right; margin: 0; padding: 0; } ol#menu li { margin: 0px 0px 0px 3px; float: left; text-align: center; } ol#menu a { background: url('images/tab.png'); color: #504E52; display: block; float: right; height: 2em; line-height: 2em; padding-left: 10px; text-decoration: none; font-weight: bold; } ol#menu a:hover { background-position: 0 -80px; } ol#menu a:hover span { background-position: 100% -80px; } ol#menu li.current { background-color: #68B2C3; background-position: 0 -80px; } ol#menu li.current a { background-position: 0 -40px; color: #FFFFFF; font-weight: bold; } ol#menu li.current span { background-position: 100% -40px; } ol#menu span { background: url('images/tab.png') 100% 0; display: block; line-height: 2em; padding-right: 10px; } /* Text: Headings, etc. */ h1, h2, h3 { text-transform: uppercase; color: #6083BB; } h1 { font-size: 1.5em; } h2 { font-size: 1.25em; } h3 { font-size: 1em; } h1.rtcol, h2.rtcol, h3.rtcol { color: #E36A07; } And the HTML: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div id="container"> <div class="logo"><img src="images/logopng.png" alt="P.C. Quick"></div> <ol id="menu"> <li class="current"><a href="index.html"><span>Home</span></a></li> <li><a href="services.html"><span>Services</span></a></li> <li><a href="contact.html"><span>Contact</span></a></li> </ol> <div class="header"> </div> <div class="content"> <h2>Test Title</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec condimentum mattis nisi id convallis. Nullam aliquam pellentesque lectus, eu hendrerit lectus dapibus et. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse potenti. Aliquam scelerisque, metus in euismod lacinia, augue tellus tempus urna, lacinia vulputate lectus quam nec ipsum. Integer iaculis nulla eu turpis fermentum quis dapibus enim consectetur.</p> <p>Nunc pulvinar cursus dolor id ornare. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum aliquet ornare lacinia. Integer sed ante leo, eu dictum enim. Ut risus purus, convallis eu rhoncus at, ultricies ut diam. Ut vel mi ut nibh tincidunt pretium sit amet quis urna. Donec sed auctor eros. Vestibulum nec odio ante.</p> </div> <div class="rtcol"> <h3 class="rtcol">Computer Training Courses</h3> <p class="rtcol">Tired of condescending looks from your kids?<br>Call us for more info! </div> </div> </body> </html> I am using <ul><li> menu. My questions are, how can I keep one element from wrapping down, when the screen size gets too small? Also, how can I make the grey of the menu span across the whole div? I tried a few things like wrapping the menu in a div with a background, setting extra elements..ect. I can't seem to keep the design with the above solutions. Any help would be appreciated. - Gnome Html Code: <div id="MainContent"> <div id="Content"> <div id="Menu"> <ul><li><a href="index.html">Home</a></li ><li><a href="index.html">Products and Services</a></li ><li><a href="index.html">Employment</a></li ><li><a href="index.html">Blah</a></li ><li><a href="index.html">Home</a></li ></ul> </div> <div id="imageWrapper"> <img src="team.jpg" class="displayed" border="0" /> </div> <div> Lorem ipsum dolor sit amet </div> </div> </div> CSS Code: #MainContent{ float: left; width: auto; } #Content{ margin-right: 265px; /*Set right margin to RightColumnWidth*/ } #Menu { backgound-color:#C0C0C0; border-top:1px Solid #C0C0C0; padding-top: 6px; padding-bottom:6px; display:block; } #Menu ul { margin: 0; padding: 0; list-style-type: none; width:auto; } #Menu ul li { display: inline; } #Menu ul li a { text-decoration: none; padding: .2em 1em; color: #FFFFFF; background-color: #C0C0C0; } #Menu ul li a:hover { color: #C0C0C0; background-color: #FFFFFF; } Does anyone know much about IE 7? In particular does it conform to the WWW consortium's box model (margins and padding). This would reduce a whole lot of extra CCS elements and headaches. Does is finally support transparent PNG files? Support for PNG will change the look of the web dramatically! So I just started a class about 4 weeks ago with CSS and I have run into a problem. Its probably a stupid mistake on my part somewhere but I can't figure it out. I have div id tags and for those id tags I have created for example: #test h2, p { font-style:italic; text-align:center; font-weight:bold; display:inline; padding: 10px; } This is because I want only the header and p content in this specific div tag to have these properties. But for some reason its spilling out onto the rest of my p and h2 tags. Why is this happening and how do I stop it so that I can control which h and p tags have specific properties? Hope someone can help!! Thanks Hi, I'm a fairly experienced programmer and am learning how to make websites in a modern way with xhtml and css. I'm trying to create a fairly simple looking front page in the vein of http://www.facebook.com/ . but i have a few css questions. Firstly, how can i give the background of my website a gradient (non -flat) colour using css? also - what is the best process when trying to make a website. I have mocked up a quick design in photoshop (image is attached to the post) and want to begin implementing. Would each part (e.g.) logo be a seperate div which links to an image? any help is appreciated as i'm used to working with tables and divs are a whole new realm for me! thanks I have 3 problems with the CSS I'm attempting (been a very long time). You can see my crud in progress at .shelleysjewelry.com/uploads/newsite/shelleys/index dot html (and, yes, it is pure crud -- besides the god-awful CSS & JS, none of the links work). I've been banging my head on these... Problem the First: I have a tricky absolute positioning situation that uses a combination of sliding dropdown menus and Javascript, like so: var h = document.getElementById(id + '-ddheader'); var c = document.getElementById(id + '-ddcontent'); var dimensions = getPosition(h); c.style.left = dimensions[0]; c.style.top = dimensions[1] + h.offsetHeight + 5; c.style.display = 'block'; "c" represents the slideout submenu and is absolutely positioned. Both values are being set to something that is expected (e.g., dimensions[0] is not zero). However, while it works in IE, it doesn't work in Firefox -- the top is being respected, but the left isn't. I understand I have a lot of margin/padding that will mess with absolute positioning, but AFAIK, that should only affect a few pixels, not render it unusable. Anyone have insight why? Problem the Second: I love the overflow property. The tabs are wrapping around. However, I'd like them to not overlap, without explicitly breaking them into two rows. I don't suppose there's any way to do that? Problem the Third: In IE, to run the site, I have to "allow ActiveX Content". There is a Javascript function that runs on startup to calculate minimum div heights and other innoconous methods. How do I get rid of that warning? Any help much appreciated... ) I have the following code: Code: <div class="Outer"> <div class="Inner"> Text one </div> </div> <div class="Outer"> <div class="Inner"> Text two </div> </div> I have the following CSS Code: .Outer{ width:150px; float:left; } .Inner{ Margin:10px: } I would like to set the Inner div in first instance of Outer to have a margin-left of 0px. I have tried the following Code: .Outer:first-child .Inner{ margin-left:0px; } This works in Chrome but not in IE, but it does work if I apply the style inline to the First Inner Div. Can it be done within the CSS file? After using tables for most of my web development life (which isn't very long) I'm diving into using divs and css to try and learn that art form. Obviously I'm running into issues that I could use some help on. I'm trying to layout a login area and I would like some direction. Here's what I have currently: Code: <div id="headerSignin"> <asp:MultiView ID="mvSignin" runat="server" ActiveViewIndex="0"> <asp:View ID="vwNotSignedIn" runat="server"> <div class="signInTitle"> Username:</div> <div class="signInTextbox"> <asp:TextBox ID="txtUsername" runat="server" Width="200px" /></div> <div class="signInTitle"> Password:</div> <div class="signInTextbox"> <asp:TextBox ID="txtPassword" runat="server" Width="200px" TextMode="Password" /></div> </asp:View> <asp:View ID="vwSignedIn" runat="server"> <div> </div> </asp:View> </asp:MultiView> </div> And the css for those tags: Code: #container #header { color: Blue; width: 1000px; height: 100px; position: relative; } #header #headerLogo { width: 600px; position: relative; float: left; } #header #headerSignin { background: #A9A9A9; width: 400px; position: relative; float: right; } .signInTitle { width: 130px; text-align: left; vertical-align: middle; float: left; } .signInTextbox { width: 200px; float: right; } With what I currently have stated there, I get the two columns evenly filling 50% of the headerSignin div. And the 'Username:' and 'Password' text are sqished at the top and the textboxes are squished together. (The colors are there just so I differntiate. ) I would like obviously for the Username and password to be next to the textboxes with a width of 130px and the textboxes be 200px with some padding in between them to seperate them. If any confusion I apologize. I'm new at divs... Hi all, I'm working on a page layout, and would like some advice. I have two questions. First, here is my code so far: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="Description" content="A Milwaukee Based Industrial Cleaning Company that specializes in Janitorial Programs, Green Cleaning, Specilaty Cleaning, One-Time Cleaning, Post-Construction Cleaning, Carpet Cleaning, Fabric Upholstery Care Floor Mainenance, Concrete Floor Coatings, Snow Removal, and Lawn Mainteneance"> <title>CSS Template</title> <link rel="stylesheet" type="text/css" href="../css/gibb.css" > </head> <body > <div id="containerDiv" style="width: 100%; height: 100%"> <div id="mastDiv" style="width: 100%; background-color: teal; height: 150px;"><p>tasd</p></div> <div id="contentDiv" style="width: 100%; height: 100%; background-color: red;"> <div id="leftArticleDiv" style="float: left; width: 90px; background-color: red;"> <p> Left Content <br /><br /> </p> </div> <div id="navDiv" style="width: 100%; height: 100px; background-color: gray; margin-left: 90px">Nav Content</div> <div id="mainDiv" style="background-color: blue; height: 100% width: 100%; margin-left: 90px;"> <p> Center Content<br /> longer <p> Center Content<br /> longer <p> Center Content<br /> longer <p> Center Content<br /> longer <p> Center Content<br /> longer </p> </div> <div id="footer" style="clear: left; height: 0px; visibility: hidden;"></div> </div> </div> </body> </html> This looks exactly how I would like it too in FF. My first question is, how can I fix it for IE. Specifically, navDiv and mainDiv appear below my leftArticleDiv, or they appear after it in IE. In FF they float right around the leftArticleDiv, but not IE. I've read many bug reports at ALA, but they don't seem to fit. Any ideas? Also, as you can see, my leftArticleDiv does not grow. That is, if it were to be longer than mainDiv, the results would be disatserous. Is ther anyway to have mainDiv and leftNavDiv always equall each other in height? So that whichever one were longer, the other one would be the same height? Thanks for your time. CJB i have three relatively simple questions -- i want to put thumbnails on my page inside the main container-- (2 column layout) i have used some code from REAL WORLD its close but not quite there-- also the thumb sizes will be different - they are stamps- like postage stamps so some horizontal and some square -- just need a tweak here also i have a gray line running thru the site--- not sure where it is coming from but i think it might be from the link container on the sidebar-- and speaking of side bar list container-- i would like it to be centered instead of up against right side-- i played with margins and padding - i am still wading thru that concept-- but coudlnt get anything to work--- so i SURE WOULD appreciate help on these three items -- many thanks in advance-- here is link to page THE PAGE here is link to CSS CSS I know how to center an element horizontally, but why does it not work with vertical centering? Horizontal (working) - Code: element.foo { margin: auto; width: 0; } Vertical (not working) - Code: element.fuu { margin: auto; height: 0; /* no values work */ } I've seen an entire layout vertically centered by containing the entire layout in a single-cell table and applying the "valign" attribute to the cell, but I'd rather not use tables. I've also checked out the W3C's "Centering Vertically" example, but it relies on the author knowing the height of the content. Since height doesn't work with %, I can't use that. Does somebody know of a way to center vertically without using absolute positioning (relative is fine) or tables, and without knowing the height of the content? I'd rather not use trial and error, but this does seem like a question that is virtually impossible to answer 100% affirmatively (about as sure as 100% height works ). I never usually code my layouts and test for validation (which after this I see they would fail horribly), even though it displays right theres so many mistakes. I finally got my layout to pass validation in HTML 4.1, but some things went wrong. First heres the links: (and yes this does involve CSS): http://65.26.50.204/ec/index.php - My Layout (View Source) http://65.26.50.204/ec/stylesheet.css - The CSS One thing I was told to do is take out height="100%" but it only told me to take it out in some places and not otheres... strange. Anyways how do I get it to stretch 100% with CSS? Second question, is it a bad practice to use a lot of css classes, I mean like if I have a CSS class used only once is that bad? Does it even matter how many I use?... it wont delay page loading time will it? Third question, I was told to remove the cellspacing tag in most of the places, is that not used anymore or what? I am working on css for a project of mine and I am having a few minor problems with the position and widths of my divs. If I have a parent container and divs within the parent container do the child containers not inherit the width and height of the parent containers? For example here is my css thus far: Code: /* CSS Document */ h1 { font-family: Geneva, Arial, sans-serif; font-size: 20px; color:#000000; } h2{ font-family: Geneva, Arial, sans-serif; font-size: 16px; color:#000000; } h4{ font-family: Geneva, Arial, sans-serif; font-size: 12px; color:#000000; } body { margin: 0; border: 0; background: #ededed; } /*============================ Begin Layout Structure ============================*/ #wrapper { width: 1024px; min-height: 768px; position: relative; margin-left: auto; margin-right: auto; margin-top: 5px, auto; background: #ffffff; } #accountselector { position: relative; height: 15px; margin-left: auto; margin-right: auto; margin-top: auto; } #headerwrapper { position: relative; padding-top: 5px; width: 100%; height: 200px; } #headerwrapper-left { position: relative; width: 65% height: 100%; } #headerwrapper-left-logo { position: relative; height: 75px; width: 100%; background: blue; } #headerwrapper-left-navigation { position: relative height: 15px; width: 100%; background: red; } #headerwrapper-left-banner { position: relative; height: 110px; width: 100%; } #headerwrapper-right { position: relative; width: 35%; height: 100%; } #headerwrapper-right-heading { position: relative; width: 100%; height: 15px; } #headerwrapper-right-customer{ position: relative; width: 100%; height: 185px; } #bodywrapper { position: relative; min-height: 478px; width: 100%; padding-top: 10px; } #bodywrapper-leftwrapper { position: relative; height: 100%; width: 20%; } #bodywrapper-leftwrapper-subnav { position: relative; height: 50%; width: 100%; } #bodywrapper-leftwrapper-news { position: relative; height: 50%; width: 100%; } #bodywrapper-rightwrapper { position: relative; height:100%; width: 80%; } #bodywrapper-rightwrapper-body { position: relative; height: 100%; width: 100%; } My HTML is as follows: Code: <!DOCTYPE html> <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="test5.css" /> </head> <body> <div id= "wrapper"> <div id= "accountselector">Home Business</div> <div id= "headerwrapper"> <div id="headerwrapper-left"> <div id= "headerwrapper-left-logo">US Sonet Logo</div> <div id= "headerwrapper-left-navigation">Link1 Link2 Link3</div> <div id= "headerwrapper-left-banner">US Sonet Banner</div> </div> <div id="headerwrapper-right"> <div id="headerwrapper-right-heading">Manage Account</div> <div id="headerwrapper-right-customer">Account Control Center</div> </div> </div> <div id="bodywrapper"> <div id="bodywrapper-leftwrapper"> <div id="bodywrapper-leftwrapper-subnav">Link1 Link2 Link3</div> <div id="bodywrapper-leftwrapper-news" >News</div> </div> <div id="bodywrapper-rightwrapper"> <div id="bodywrapper-rightwrapper-body"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras volutpat, purus ac pellentesque adipiscing, mauris ligula convallis metus, vitae scelerisque nibh orci quis mi. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur porttitor aliquam libero. Quisque molestie ornare sem. Nam euismod sem lacinia ipsum. In pharetra metus ut dolor cursus aliquam. Maecenas eu ante quis enim tincidunt laoreet. Pellentesque varius nunc in ipsum pulvinar sollicitudin. Nunc et mi. Donec auctor dignissim orci. Aliquam sed magna. Pellentesque in dui. In eget elit. Praesent eu lorem.</p> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras volutpat, purus ac pellentesque adipiscing, mauris ligula convallis metus, vitae scelerisque nibh orci quis mi. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur porttitor aliquam libero. Quisque molestie ornare sem. Nam euismod sem lacinia ipsum. In pharetra metus ut dolor cursus aliquam. Maecenas eu ante quis enim tincidunt laoreet. Pellentesque varius nunc in ipsum pulvinar sollicitudin. Nunc et mi. Donec auctor dignissim orci. Aliquam sed magna. Pellentesque in dui. In eget elit. Praesent eu lorem.</p> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras volutpat, purus ac pellentesque adipiscing, mauris ligula convallis metus, vitae scelerisque nibh orci quis mi. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur porttitor aliquam libero. Quisque molestie ornare sem. Nam euismod sem lacinia ipsum. In pharetra metus ut dolor cursus aliquam. Maecenas eu ante quis enim tincidunt laoreet. Pellentesque varius nunc in ipsum pulvinar sollicitudin. Nunc et mi. Donec auctor dignissim orci. Aliquam sed magna. Pellentesque in dui. In eget elit. Praesent eu lorem.</p> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras volutpat, purus ac pellentesque adipiscing, mauris ligula convallis metus, vitae scelerisque nibh orci quis mi. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur porttitor aliquam libero. Quisque molestie ornare sem. Nam euismod sem lacinia ipsum. In pharetra metus ut dolor cursus aliquam. Maecenas eu ante quis enim tincidunt laoreet. Pellentesque varius nunc in ipsum pulvinar sollicitudin. Nunc et mi. Donec auctor dignissim orci. Aliquam sed magna. Pellentesque in dui. In eget elit. Praesent eu lorem.</p></div> </div> </div> </div> </body> </html> Why aren't the children divs inheriting their width from the parents or do they not function this way? Hi, I've been using nested layers in Dreamweaver and wanted to know if it's possible to hide all nested layers of a given layer (say A) by applying a behavior to hide just the layer A to an object? Or is it that in order to hide the nested layers also, I'll need to apply behaviors for each nested layer separately? Also, is there a way to load the content of a layer (such as swf movies, images and other stuff) only when its property is changed to visible (by default the layer is hidden). Thanks, Jayant Id really like to use css for page layout. Im using asp.net and I need to setup a template that all my pages use. Id rather not use tables, but ive had trouble using css in the past. I need a layout that allows for a header certered section (used to do it with a nested, centered table) center section should have shaded edges to simulate a printed page footer menubar below the header I also need the content area to expand and not go bezerk when i add data in a table or a large image. Can anyone point me to an example that does this ? First: I have seen: p.classname and just .classname What is the difference between the two if the latter is applied to a paragraph? Also: I have seen classes stack on top of each other like: <p class ="classname" class ="classname2">text</p> <p class = "classname" id = "idname">text</p> So is there a way to use classes with other classes id with other ids or classes and ids together like the above? Hi, I'm designing a web site using a full CSS layout with XHTML. It's quite challenging as I'm used to complex table designs. My design is located at http://www.definitedigital.com/vida/index.html And the style sheet at http://www.definitedigital.com/vida/style.css There's some things that look different across browsers, and I'm not sure if it's some sort of bug or my mistake. For example, 1. On Firefox the 'Punta Del Este Vida Beach House' link image is sometimes detected and sometimes unclickable. 2. There's much more vertical spacing between the divs (logo, photo, menu) in Firefox than in IE. I'd really appreciate if someone could take a look at my CSS, as I don't really know whether I'm doing this right or not. Thanks, Ralph Hi all, What does this mean? H1 A:link { color:#fff } - or - .sectionhead H2 { font-size: 12px; } I'm asking specifically about the space between the name of the selector and the HTML tag reference. What function does that space have? If it were a comma I would know, but I don't know what a space means. Sorry if totally dumb question. Also, I keep seeing three-character hex values (e.g., #fff, #0cd, #078, etc). How are they used, what do they mean? I would have thought it meant to repeat the three characters to make the six (eg, #ffffff, #0cd0cd, #078078) but that appears not to be the case. I've been looking around w3schools.org to find answers to questions like these, but no luck. Any suggestions? Thanks to anybody who takes the time to answer! Laura S. ultimately, I would like to have a container that holds three equal columns...my issue is that each time I try to define a container and put a column inside the container...it doesn't sit "inside" the container. Just a quick piece of code to demonstrate my issue: body { margin:0px; background-color:#999; } #container { margin:70px 10px 30px 10px; border:5px solid #424242; background-color:#fff; } #left { position:absolute; top:70px; left:0px; margin:20px; background-color:red; width:150px; } <body> <div id ="container"> <div id="left"></div> </div> </body> Now, I know that I am new to CSS and I also figure that my coding is wrong and that I am making an elementary mistake. Any and all comments and help are appreciated...please be gentle! haha thanks jon |