CSS - Clear All Previous Css Commands
Thanks for taking the time to read my question.
I have one div within several larger div's (one box inside several larger boxes) The larger boxes have certain formats on them. I don't want any of them to apply to the small box in question. How do I clear all of the previous commands? Page in question: This is what it looks like now. I want to change the tree structure at the bottom (Past Pierced Shows) www.pierced.ca/pierced-events.htm What it should look like (Not color, just layout) www.pierced.ca/NoName.html Thanks for your help. Brad Similar TutorialsHi, I have recently started learning CSS by myself, so am at the beginners level. I have been trying to put together a friend's site and now stuck with a Firefox problem. I think my Firefox is not recognising the CSS div commands, but it's great to see that Safari & Google Chrome is being nice. As I am a new user in this forum, it's not allowing me to post any links, so if there is anyone to help, I can forward you the site link at your email or if there is any other way to see the difference on Firefox & Google Chrome. Many thanks in advance! Here is the default css.css file for a php directory I use >> http://www.phpmydirectory.com/demo/template/default/css.css I want to create custom fields in user/listee admin that allow a user/listee to choose things like scrollbar colors, page colors, text sizes etc on their individual listing page. Each listing page has a header.tpl file w/ <head>/</head> section. Each .tpl file calls the default css.css file above. How can I echo new css fields into either the css.css file or the actual listing.php of the listing page itself? I got a suggestion to use this but I cannot make it work. Code: <? if (on_page('listing.php')) { ?> etcetcetc I've tried maybe 10 different ways. No luck. Should I convert the css file to php file & echo custom fields into it & call the php/css file to the listing page header? Hi all, I'm trying to create a simple menu with rollover links using CSS, but while it works in IE, it stops as soon as the link text ends in Firefox. Is this because Friefox is ignoring the width and heigh commands in CSS? And is there any way to fix this? If so, how? I've got this working on Firefox Code: .menu_item { } .menu_item a:link{ width: 163px; height: 21px; padding-top: 4px; padding-left: 20px; background-image: url(menu_rollover_0.gif); background-repeat: no-repeat; color: #6A7182; text-decoration: none; } .menu_item a:active{ width: 163px; height: 21px; padding-top: 4px; padding-left: 20px; background-image: url(menu_rollover_0.gif); background-repeat: no-repeat; color: #6A7182; text-decoration: none; } .menu_item a:visited{ width: 163px; height: 21px; padding-top: 4px; padding-left: 20px; background-image: url(menu_rollover_0.gif); background-repeat: no-repeat; color: #6A7182; text-decoration: none; } .menu_item a:hover{ width: 163px; height: 21px; padding-top: 4px; padding-left: 20px; background-image: url(menu_rollover_1.gif); background-repeat: no-repeat; color: #ED1C2D; text-decoration: none; } Cheers. I have the following in my css: Code: input, textarea, select { font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #ECEEF1; border: 1px solid #505355; color: #505355; margin: 3px; font-size: 10px; } input:hover, textarea:hover, select:hover { background-color: #FFE7DB; border: 1px solid #D64800; color: #D64800; } and then I have something like this on my page: <input name="rate" type="radio" value=6 onclick="this.form.submit()" class="rateradio" /> How can I make the class selector 'rateradio' to override the background-color and border options in the input and input:hover css? I have some inputs wich I want that css to work but some inputs I want to override the background color and the border, how can I do it? I am trying to figure out how to nullify all of the previously set CSS styles in a portion of a page. Then, be able to set new styles to affect just that portion. The situation is this: Using a Wordpress theme, I have a single article that I want to be formatted completely differently than normal. However, there are css styles for things like <body>, <td>, <blockquote> etc (lots of them) that I already set in the theme itself. I don't want these theme-defined styles to affect the article portion, for this article only, and only for the article portion of the page. Is this possible, other than by re-declaring all the css values that are set in the theme? I've got a div that incorporates some inline styling. Looks fine on a blank page, but when I insert it into a more complex page it inherits all the styling of the stylesheets. Is there anyway to I can have this div ignore all inherited styling and just format itself according to browser defaults and its own inline styling? I'm using float:left for my left nav bar, and then clear:both for my footer. Trouble is, I need to use some content boxes that will be using floats and then clears, however, when I use clear:both in my content box, it clears EVERYTHING (meaning it pushes below my navbar, because the navbar is quite long). Is there a workaround or am I using floats/clear wrong? TIA Javashackgirl I have a site with a bunch of floats. It looks something like this: [HTML]<div id="nav" style="float: left"> </div> <div id="content"> <div style="float: left"> </div> <div style="float: right"> </div> <br style="clear: both" </div>[/HTML] Now that clear:both also clears #nav instead of the two divs in #content. Is there any way to fix this so it doesn't clear #nav? Can someone explain to my why my "spacer" div is not working (i'm looking in IE7 & Firefox)? Here's the page (I put a 1p border around the "clear" div so that you can see it for testing): http://www.welcome-home-interiors.net/services.php Below is the HTML and CSS... HTML: Code: <body> <div id="container"> <div id="header"> <?php include('includes/flashHeader.php'); ?> </div> <div id="nav"> <?php include('includes/navbar.php'); ?> </div> <div id="maincontent"> <div id="mainLeftText"> <p><img src="images/headers/services.gif" alt="SERVICES" width="188" height="49" /></p> <div id="mainLeft"> <p><span class="header">INTERIOR DESIGN</span><br /> Whether it's simply choosing a paint color or extensively remodeling a kitchen, Welcome Home Interiors can offer you guidance. Space planning and 3D Images are available so that you can visualize your room and make changes before any labor or purchasing is made.</p> <p><span class="header">REAL ESTATE STAGING</span><br /> "Set the Stage" by rearranging current furnishings and accessories to create your own "model home" - spacious, fresh, and beautiful - exactly what buyers are looking for! As trained professionals, Welcome Home Interiors will assist you in establishing a perfect first impression - an important factor in selling your home for the highest price and in the shortest amount of time. In a 1 to 2 hour consultation we will offer suggestions to enhance your home easily and economically, and leave you the comprehensive list of tasks we've discussed. If you'd prefer, you can enjoy the instant gratification of having us rearrange your space on the spot. We also can add pieces from our inventory to enhance your belongings or even fill your vacant home.</p> <p><span class="header">ROOM REDESIGN</span><br /> Welcome Home Interiors can give your room a whole new look using the furniture and accessories currently in your home. Want to add a few fresh pieces? Let us provide you with a design plan tailored to meet your lifestyle. We can roll up our sleeves and complete the look for you, or turn over the plan for the "do-it-yourselfers".</p> <p><span class="header">SHOPPING</span><br /> Do you get overwhelmed by all the options? Or just don't have time to shop? Let's discuss the look you're dreaming of and establish a budget, then Welcome Home Interiors will locate it and bring it to you.</p> <p><span class="header">YOUR NEW PLACE</span><br /> Welcome Home Interiors will recycle your existing furnishings into your new home. We will offer answers to all of those design questions about paint, window treatments, and finishing touches so you'll soon have the "at home" feeling in your new surroundings.</p> <p><span class="header">GIFT CERTIFICATES</span><br /> Welcome Home Interiors GIFT CERTIFICATES make wonderful hostess, house warming, wedding, birthday, and special occasion gifts. They can be customized to your needs.</p> <p><span class="header">FEES</span><br /> Together, Lori and Teri of Welcome Home Interiors are $75.oo an hour for design consulting. Prop rental for real estate staging is quoted per room.</p> </div> </div> <div id="mainRight"> <p><img src="images/indexPic.jpg" alt="Welcome Home Interiors" width="310" height="415" /></p> </div> <div class="spacer"> </div> </div> </div> </body> CSS: Code: html, body { background: #DACCCC; font-family: Georgia, "Times New Roman", Times, serif; padding: 0; margin: 0; color: #6E6E53; height: 100%; line-height: 1.5em; } a:link, a:visited, a:active { text-decoration: underline; color: #6E5256; } a:hover { text-decoration: none; color: #7F0A32; } #container { background: #000; width: 780px; margin:auto; padding: 0; text-align: justify; height: 100%; } #header { background-color: #FFF; width: 100%; height: 272px; margin: 0px; padding: 0px; border-left: 6px solid #6E5256; border-right: 6px solid #6E5256; } #nav { width: 100%; height: 32px; background: url(../images/nav/navLeftFade.jpg) #7F0A32 top left no-repeat; margin: 0px; padding: 0px; text-align: left; border-left: 6px solid #6E5256; border-right: 6px solid #6E5256; } #nav img { margin: 0px; padding: 0px; width: 126px; height: 32px; vertical-align: top; } #maincontent { background-color: #CAD49F; height: 100%; margin: 0px; padding: 0px; width: 100%; border-left: 6px solid #6E5256; border-right: 6px solid #6E5256; overflow: visible; } #mainLeftText { width: 350px; float: left; padding: 20px 0px 0px 10px; margin: 0; overflow: hidden; } #mainLeft { width: 320px; padding: 0px 0px 0px 30px; margin: 0; float:left; } #mainRight { width: 350px; float: right; padding: 50px 5px 0px 0px; margin: 0px; overflow: hidden; } .header { font-weight: bold; text-align: left; text-decoration: underline; margin-bottom: 0px; padding-bottom: 0px; } .spacer { clear: both; border: 1px solid; } /* NAVIGATION ROLLOVERS */ a#home:link, a#home:visited, a#home:active { margin-left: 150px; display: inline-block; width: 126px; height: 32px; text-decoration: none; background: url(../images/nav/home.gif); } a#home:hover { margin-left: 150px; background-position: -126px 0px; } a#services:link, a#services:visited, a#services:active { display: inline-block; width: 126px; height: 32px; text-decoration: none; background: url(../images/nav/services.gif); } a#services:hover { background-position: -126px 0px; } a#gallery:link, a#gallery:visited, a#gallery:active { display: inline-block; width: 126px; height: 32px; text-decoration: none; background: url(../images/nav/gallery.gif); } a#gallery:hover { background-position: -126px 0px; } a#testimonials:link, a#testimonials:visited, a#testimonials:active { display: inline-block; width: 126px; height: 32px; text-decoration: none; background: url(../images/nav/testimonials.gif); } a#testimonials:hover { background-position: -126px 0px; } a#contact:link, a#contact:visited, a#contact:active { display: inline-block; width: 126px; height: 32px; text-decoration: none; background: url(../images/nav/contact.gif); } a#contact:hover { background-position: -126px 0px; } Thanks!... I'm trying to get a container div to stretch to the size of it's contents. Note, #navigation and #title will be for aesthetics only and aren't being used yet. Am I wrong in thinking that the clear has to go in the containing div, not the component divs? Anyway, I've tried both and neither works. I have: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title>My Blog</title> </head> <body> <div id="title"> <!-- title --> </div> <div id="navigation"> <!-- search --> <!-- jumpbox --> <!-- subscription_and_rss_images --> </div> <div style="border:3px solid red; clear:both"> <div class="leftcolumn" style="border:3px solid green;"> <!-- menu --> <!-- leave this tag in for menu in Admin CP --> <!-- referrers --> <!-- photo --> <!-- calendar --> <!-- baby --> </div> <div class="rightcolumn" style="border:3px solid blue;"> <!-- content --> </div> </div> <div style="border:3px solid yellow;"> <!-- credit --> </div> </body> </html> And CSS: Code: div.leftcolumn{ float: left; width: 200px; } div.rightcolumn{ position: relative; margin-left: 205px; padding-left: 5px; border-left: 1px solid #222222; } This produces: Hello, The divs numbered #4(extra2) and #5(navigation2) cannot give way to other divs . How can I clear the other divs? Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Template 8</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <style type="text/css"> html,body{margin:0;padding:0} body{font: 76% arial,sans-serif;text-align:center} p{margin:0 10px 10px} a{display:block;color:#981793;padding:10px} div#header h1{height:80px;line-height:80px;margin:0; padding-left:10px;background: #EEE;color: #79B30B} div#container{text-align:left} div#content p{line-height:1.4} div#navigation{background:#B9CAFF} div#navigation2{background:#CC33FF} div#extra{background:#FF8539} div#extra2{background:#996633} div#footer{background: #333;color: #FFF} div#footer p{margin:0;padding:5px 10px} div#container{width:700px;margin:0 auto} div#wrapper{float:left;width:100%} div#content{margin: 0 150px} div#navigation{float:left;width:150px;margin-left:-150px} div#navigation2{float:left;width:150px;margin:170px 0 0 -150px} div#extra{float:left;width:150px;margin-left:-700px} div#extra2{float:left;width:150px;margin:170px 0 0 -700px} div#footer{clear:left;width:100%} </style> </head> <body> <div id="container"> <div id="header"> <h1>website name</h1> </div> <div id="wrapper"> <div id="content"> <p><strong>1) Content here.</strong> column long long column very long fill fill fill long text text column text silly very make long very fill silly make make long make text fill very long text column silly silly very column long very column filler fill long make filler long silly very long silly silly silly long filler make column filler make silly long long fill very.</p> <p>very make make fill silly long long filler column long make silly silly column filler fill fill very filler text fill filler column make fill make text very make make very fill fill long make very filler column very long very filler silly very make filler silly make make column column </p> <p>fill long make long text very make long fill column make text very silly column filler silly text fill text filler filler filler make make make make text filler fill column filler make silly make text text fill make very filler column very </p> <p>column text long column make silly long text filler silly very very very long filler fill very fill silly very make make filler text filler text make silly text text long fill fill make text fill long text very silly long long filler filler fill silly long make column make silly long column long make very column long make </p> </div> </div> <div id="navigation"> <p><strong>2) Navigation here.</strong> long long fill filler very fill column column silly filler very filler fill fill filler text fill very silly fill text filler silly silly filler fill very make fill column text column very very column fill fill very silly column silly silly fill fill long fillercolumn fill fill very silly column silly silly fill fill long filler column fill fill very silly column silly silly fill fill long filler column fill fill very silly column silly silly fill fill long filler </p> </div> <div id="navigation2"> <p><strong>5) Cannot clear above div (id=Navigation).</strong> cannot clear above div, this div should be below the div NAVIGATION</p> </div> <div id="extra"> <p><strong>3) More stuff here.</strong> column long make silly silly filler silly very very very long column filler fill make column make silly column fill silly column long make silly filler column filler silly long long column fill silly column very filler silly long long column fill silly column very filler silly long long column fill silly column very filler silly long long column fill silly column very filler silly long long column fill silly column very </p> </div> <div id="extra2"> <p><strong>4) Cannot clear above div (id=EXTRA).</strong> cannot clear above div, this div should be below the div EXTRA </p> </div> <div id="footer"><p>Here it goes the footer</p></div> </div> </body> </html> Hello, Consider the following design: <div id="container"> <div id="A" class="A"></div> <div id="B" class="B"></div> </div> And the CSS classes: .A {float:left; clear:left} .B {float:left; clear:right} This does not work well. So I always do as follow: <div id="container"> <div id="A" class="A"></div> <div id="B" class="B"></div> <div id="clear" class="clear"></div> </div> Whe .A {clear:both} This always happens when I have divs inside other divs. Does anyone knows how to solve this? Thanks, Miguel never mind. I have some simple code that works in all recent browsers, including IE8+. But with some people out there still using IE7, for which it does something odd, and I've been asked to make it work with that as well. I've dumbed it down to it's basics, and it's just easiest to see with a visual. http://www.poweredpages.com/test.php I have four boxes, labeled 1 through 4. It's supposed to wrap at 3, with 4 to the right of that box. In IE7, It wraps at 3 (correctly, because of the clear), but then box 4, which has a float:left after the cleared 3 box, jumps back up to the 1 and 2 row. Any thoughts on how do get this working with the least amount of editing would be appreciated. In real life, I have the left boxes as a class "label" and the right boxes as another class "input", so if I could just add something to one of these classes and be done w/ it, that would be great. Of course, I could put another entire DIV around each row to fix this, but that would require altering a whole bunch of code. Thanks! Prof Here's the code: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <body> <div style="clear:both;width:50px;float:left;border:1px solid red">1st</div> <div style="float:left;border:1px solid green">2nd</div> <div style="clear:both;width:50px;float:left;border:1px solid blue">3rd</div> <div style="float:left;border:1px solid orange">4th</div> </body> </html> Hi, Im not sure whats going wrong with this, but I have two DIV elements on the page: 1st div "googleMap" CSS for googleMap: #googleMap { height: 300px; width: 500px; float: left; } 2nd div "page_right" CSS for page_right: #page_right { width: 300px; clear: left; float: right; } Could someone please tell me why page_right DIV is not clearing the googleMap div? I've just about had enough so hope some kind person will no the answer!! Here is the live page (showing the flaw): belvoir-mortgages.co.uk/contact.php Thanks Lee I can't figure out how to clear the float for the columns with the text column 1 and 2. If the other columns dont have a lot of text then the footer defaults to just under the image so where that 1+2 start. Any ideas plase? Code: <div id="container"> <div id="home_col_1"> <img src="images/holder_slideshow.png" alt="" width="446" height="365" /> <div id="home_col_1_1"> column 1<br /> column 1<br /> column 1<br /> column 1<br /> column 1 </div> <div id="home_col_1_2"> <p> column 2</p> <p>column 2</p> <p>column 2</p> <p>column 2</p> <p>column 2</p> </div> </div> <div id="home_col_2"> <p>column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3</p> </div> <div id="home_quicksearch"> Search Box Here </div> <div id="home_col_3"> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> </div> <div id="home_col_4"> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> </div> <div class="clear_floats"></div> </div> Code: #container { width: 986px; margin:0 auto; } #home_col_1 { width:446px; height:365px; float:left; } #home_col_1_1 { width:207px; float:left; padding:0 10px 0 0; border-right:#CECECE 1px solid; margin-top:10px; } #home_col_1_2 { width:207px; float:left; padding:0 10px 0 10px; border-right:#CECECE 1px solid; margin-top:10px; } #home_col_2 { width:171px; float:left; padding:10px 10px 0 10px; border-right:#CECECE 1px solid; } #home_col_3 { width:165px; float:left; padding:0 10px; border-right:#CECECE 1px solid; } #home_col_4 { width:142px; float:left; padding:0 10px; } #home_quicksearch { width:328px; padding:10px 10px 10px 0; float:left; border-bottom:#CECECE 1px solid; margin:0 0 10px 10px; background-color:#FFFFFF; } #footer { width: 966px; margin:0 auto; padding:10px; margin-top:10px; border-top:#CECECE 1px solid; } Hello, I have used the containment hack in several of my projects. However I found examples where they use "<div style="clear:both"></div>". The result is the same. So which one should I use? This page works fine in Firefox, but in IE, the float makes the content move off the page to the left. I figured out that without a background-color applied to the .textBox style (which is the DIV that contains the text and image I am floating) it works. However, I really would like the .textBox to have a background color. Anybody knows what to do? Here is the page: http://www.jbbdesign.com/wip/index4.html many thanks, Julia Does anyone know why the clear: left isn't working on firefox 1.0 on this page. Generic Page with floating divs and then clearing them for a new line. http://section31.us/temp/float_boxes.html Am I doing something wrong or is this a bug? Hi, I have a problem with the following page, basically the second album blocks (labelled "2006, Carnival") won't start until the navigation menu on the left has finished: http://www.realsteel.org.uk/photos/ The following page suffers a similar problem, with the address not starting until the navigation menu on the left has finished: http://www.realsteel.org.uk/contact/ in this case I thought I could fix it by removing the clear on .contact_system .area but then this broke the formatting of the address. Can I apologise in advance for the poor shape of my CSS and XHTML, I'm in the position of not having anything enough time to spend on this aspect of the project. I find that I only get to work on the CSS / XHTML side of things every few months or less, consequently each time I look at it I've forgotten what I learnt the last time and am back to square one. I also find that I don't know why I did what I did the last time! I hope someone can find it in their time to assist! All constructive criticism is very much welcome, whether to do with the above problem or not. Thanks, Geoff |