CSS - Newbiest Of Newbie Questions
Ok, I'm brand new to the world of HTML, XHTML, and CSS. I recently completed a web page and validated it with w3c as XHTML 1.0 Strict and CSS, with the appropriate validation icons.
My question is... Is the w3c icon for CSS the same as CSS1? I understand there are differences between CSS1 and CSS2, but is CSS just a generic term for all CSS, or is CSS1 different than CSS? Thanx a billion! mb Similar TutorialsOkay, I'm new to CSS and at the moment, for class, we're supposed to be doing CSS with tables. That's probably good, because I can't imagine the frustration level I'd be at if I was doing pure CSS. I have two issues (right now) that I need help with. http://www.esdcar.org/web/test/templateh.shtml http://www.esdcar.org/web/test/stylesh.css The first is the area on the left with the (placeholder) banner ads, using a perl include. No matter what I do, I can't get IE on PCs to apply a font size of 10px to the text under the banners. (Although it does recognize the color.) At home on my Mac, IE does treat it right. I started with the attribute applied to the UL, but when that didn't work, my teacher suggested applying it to the LIs, which I did to no avail, and after that I put the attribute inside the overall ID (#leftads) for that cell, too, just for kicks. Nothing worked, and that was the only suggestion from the teacher; now he's stumped. Okay, I could comment out the text in the .cgi, but that's not really the point. The other question I have is about the box on the right. Getting it to line up how I wanted, with five even LI sections spanning the picture, on every browser, was out of the question and I finally gave up. However, I got it to where it looked okay (not pushing beyond the bg pic, for example) on IE and Safari on my Mac, and IE and FireFox on the school PCs, and I was content -- until I went to work and tried it there. IE on a PC, just like at school, and yet it was all fubared. The header wrapped around and continued under the brown box, and the five LIs pushed way past the image. Does anyone know how I can overcome these issues? Any suggestions appreciated! I've just started with CSS and am having some problems. First, the site I am working on will have a horizontal drop-down menu at the top, and a footer at the bottom. The menu will consist of 4 sections, and the footer 1. The dimensions of the menu and footer are exactly the same. I want them both centered (horizontally) and obviously aligned (the left and right edges of the menu and footer should line up). Right now, I am unable to do that without adjusting width and padding. Since the menu and footer are the same size, then I don't see why I should be adjusting the width and padding, so I am very confused. Here is the code for the menu: Code: #leftm { margin: 0; padding: 0; list-style: none; float: left; font: bold 20px Verdana; font-weight: 600; } #leftm a { background: url(img/left.gif) top left no-repeat; color: white; display: block; margin: 0 0 0 0; padding: 5px 0px 10px 0px; width: 250px; text-align: center; text-decoration: none; } #leftm a:hover { background: url(img/left.gif) top left no-repeat; color: yellow; } #rightm { margin: 0; padding: 0; list-style: none; float: left; font: bold 20px Verdana; font-weight: 600; margin: 0 0 0 0; } #rightm a { background: url(img/right.gif) top right no-repeat; color: white; display: block; margin: 0 0 0 0; padding: 5px 0px 10px 0px; width: 250px; text-align: center; text-decoration: none; } #rightm a:hover { background: url(img/right.gif) top right no-repeat; color: yellow; } #rootlist { margin: 0; padding: 0; list-style: none; float: left; font: bold 20px Verdana; font-weight: 600; } #rootlist a { background: url(img/middle.gif) top right no-repeat; color: white; display: block; margin: 0 0 0 0; padding: 5px 0px 10px 0px; width: 250px; text-align: center; text-decoration: none; } #rootlist a:hover { background: url(img/middle.gif) top right no-repeat; color: yellow; } /* below are sub menus of rootlist (divs) */ #rootlist div { background: url(img/s_middle.gif) center center no-repeat; margin: 0; padding: 0; visibility: hidden; } #rootlist div a { background: url(img/s_middle.gif) center center no-repeat; color: white; position: relative; display: block; margin: 0; width: auto; white-space: nowrap; text-align: center; text-decoration: none; font: 14px Verdana; } #rootlist div a:hover { background: url(img/s_middle.gif) center center no-repeat; color: yellow; } As you can see, #leftm and #rightm are pretty much identical, except for the background. Is there a way for me to re-use the same code, rather than making both #leftm and #rightm? It seems silly since the only difference is the background image. Here is the footer: Code: /* footer */ #footer { background: url(img/footer.gif) top right no-repeat; color: white; display: block; margin: 0 0 0 0; padding: 6px 0px 16px 0px; width: 1040px; text-align: center; text-decoration: none; font: 11px Verdana; } #footer a {color: white;} #footer a:hover {color: yellow;} Here is the rest of the CSS: Code: body { margin: 20px 20px 0px 20px;} #box { width: 1060px; height: 860px; margin: 0px auto -1px auto; } As you can see in the footer, the width is 1040px. The image I will use for the footer is 1000px wide. However, if I set the width to 1040px in #footer, the footer section is not aligned with the top menu - it is left of the top menu. How can I get my menu and footer aligned without worrying about width adjustments, padding and so on? I think there must be a simple way of doing it since the width and height of the menu and footer will be the same. I'd appreciate any help with this. 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! 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... ) 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 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? 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 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? 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 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? 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 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 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, 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 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 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; } 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 ). Here is the webpage 1) Each of the globes as well as the text below is a link to other sites. Using css to change the image to the same globe - but not faded - do I have to have both images be a background image?? Currently the image is in the html. 2) Since each globe is different, then do I need to create a class for each one?? Thanks! |