CSS - Menu Questions
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; } Similar TutorialsI'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 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 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 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 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? 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... ) 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, 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 ? 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 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 ). 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? 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 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? Hey. Web Page-Main CSS Links I have created a CSS only based web site using a tutorial off the net. I have a couple of questions. 1. I have created my main web page and I want to know what is the best way to create my other linked pages ie, Services, About Us, Contact ect. Should I just to a save as on the doc or is there another way? All my CSS is linked. 2. Using CSS with ul li navigation, is there a way I can add/update the text (link) for my horizonal menu in all my differnet pages. ie Contact Us, About Us ect? Or do I have to copy paste the text/link in all the pages? 3. Last question is with my horizontal nav bar. The active link works fine in IE 6 but when I try it in Firefox 1.5.0.3 it loses the text colour and the border changes to dotted. What I'm I missing on this one? Thanks Matt here is my css stylesheet. I try to validate and I get warnings. some things i was able to fix, others I am unsure of. Code: .ul {list-style-image: url("images/bullet_blue.gif"); vertical-align:middle;} body { background-color: #999999; background:url(images/bkg_black.gif); font-size:15px; color:#FFFFFF; font-family:Verdana, Arial, Helvetica, sans-serif; } h4 { color: #0099FF; font-family:Verdana, Arial, Helvetica, sans-serif; } h2 { color: #FFFFFF; font-family:Verdana, Arial, Helvetica, sans-serif; } th{ background-image:url("images/tbhead.gif"); } a:link {color: #FFFFFF; text-decoration: none; font-family:Verdana, Arial, Helvetica, sans-serif;} a:active {color: #FFFFFF; text-decoration: none; font-family:Verdana, Arial, Helvetica, sans-serif;} a:visited {color: #FFFFFF; text-decoration: none;font-family:Verdana, Arial, Helvetica, sans-serif;} a:hover {color: #0099FF; text-decoration: underline;font-family:Verdana, Arial, Helvetica, sans-serif;} a:link.email {color:#000000; } a:active.email {color:#000000; } a.visited.email {color:#000000; } #container { width: 87%; margin: 20px auto; background-color: #000000; color: #FFFFFF; border: 1px solid #333333; line-height: 130%; } #top { padding: .5em; background-color: #000000; border-bottom: 1px solid gray; } #nav { padding: .5em; background-color: #000000; border-bottom: 1px solid gray; } #content { padding: 2em; max-width: 36em; } #footer { clear: both; margin: 0; padding: .5em; color: #333333; background-color: #999999; border-top: 1px solid gray; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; } #index{ float:left; width:65%; border-right:2px solid #000; border-bottom:2px solid #000; margin-right:15px; padding-bottom:20px; } #indexright{ width:35%; float:right; top: 5px; } ul#navlist { padding: 3px; margin: 8px; list-style-type: none; color: #ffffff; background-color: #000000; } ul#navlist li { display: inline; } ul#navlist li a { width: 10%; color: #ffffff; background-color: #000000; padding: 0.2em 1em; text-decoration: none; border: 1px solid #ffffff; } ul#navlist li a:hover { background-color: #369999; color: #ffffff; } .lyrics { font-size:10px; } .table { font-size:12px;} 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 |