CSS - Override Embedded Css With Linked Css?
Hi can anyone tell me if I can override embedded CSS with a linked stylesheet?
Here is what I want to change: Code: <col width="40%" style="background-color:#EEEEEE;text-align:left;"> I want to change the background-color without changing anything in the above mentioned code, this means I want to change it with an extern stylesheet. Similar TutorialsSo I have an ad that is being served via an IFRAME. The src of the iframe has a few places where I can change colors as the css is dynamic based on the query string. There is one css element that is not supported with the user option to change the color and I want to try and override it. Obviously inline styles override embedded styles, but the element I need to override is span.price { color:#990000; } and that is within the source of the iframe. Is there a way to override this? First off, I'll preface that I'm not a CSS expert by any means. I've done web development for many years, but have slowed down a great deal over the last few, so never got heavily into the aspects of CSS that completely replace HTML (tables, etc.). At my current place of employment (where my primary duty is not that of a web developer, thank god), I'm being asked to develop a set of 'templates' using primarily CSS. I've been using the CSS Sculpter plug in for Dreamweaver, and have had decent results from it, but my main issue at this point is this: When I take the CSS code from the header of the page and put it into a separate stylesheet and then link to that stylesheet, it jacks up the content portion of the site. It seems to be completely disregarding the right margin of the content div and allowing text to simply run off. When the code (without changes) is pasted back into the header of the page rather than linked to it, the issue is resolved. Here's the CSS: Code: <style type="text/css" media="all"> <!-- /* This rule resets a core set of elements so that they will appear consistent across browsers. Without this rule, content styled with an h1 tag, for example, would appear in different places in Firefox and Internet Explorer because each browser has a different top margin default value. By resetting these values to 0, the elements will initially be rendered in an identical fashion and their properties can be easily defined by the designer in any subsequent rule. */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6 { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; } /* The body is the outermost layout component and contains the visible page content. Setting properties for the body element will help to create consistent styling of the page content and more manageable CSS. Besides using the body element to set global properties, it is common to use the body element to set the background color of the page and create a centered container for the page content to display. */ body { background-color: #666; color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: 14px; margin: 0 0 0 0; /* Sets the margin properties for an element using shorthand notation (top, right, bottom, left) */ padding: 0 0 0 0; /* Sets the padding properties for an element using shorthand notation (top, right, bottom, left) */ text-align: center; /* Centers the page content container in IE 5 browsers. */ } /* Commonly used to style page titles. */ h1 { color: #000; font-size: 14px; font-weight: bold; line-height: 14px; } /* Commonly used to style section titles. */ h2 { color: #000; font-size: 12px; font-weight: bold; line-height: 14px; } /* Sets the style for unvisited links. */ a, a:link { color: #000; font-weight: bold; text-decoration: none; } /* Sets the style for visited links. */ a:visited { color: #000; font-weight: bold; text-decoration: none; } /* Sets the style for links on mouseover. */ a:hover { color: #000; text-decoration: underline; } /* Sets the style for a link that has focus. */ a:focus { color: #000; } /* Sets the style for a link that is being activated/clicked. */ a:active { color: #000; } /* This is a container for the page content. It is common to use the container to constrain the width of the page content and allow for browser chrome to avoid the need for horizontal scrolling. For fixed layouts you may specify a container width and use auto for the left and right margin to center the container on the page. IE 5 browser require the use of text-align: center defined by the body element to center the container. For liquid layouts you may simply set the left and right margins to center the container on the page. */ #outerWrapper { background-color: #fff; border-left: solid 1 px #666; border-right: solid 1 px #666; margin: 0 auto 0 auto; /* Sets the margin properties for an element using shorthand notation (top, right, bottom, left) */ text-align: left; /* Redefines the text alignment defined by the body element. */ width: 650px; overflow: hidden; } #outerWrapper #header { background-color: #ddd; border-bottom: solid 1px #666; /* Sets the bottom border properties for an element using shorthand notation */ font-size: 18px; font-weight: bold; line-height: 15px; padding: 0px 0px 0px 0px; /* Sets the padding properties for an element using shorthand notation (top, right, bottom, left) */ } #outerWrapper #topNavigation { background-color: #ebebeb; border-bottom: solid 1px #666; /* Sets the bottom border properties for an element using shorthand notation */ height: 10px; padding: 10px 10px 10px 10px; /* Sets the padding properties for an element using shorthand notation (top, right, bottom, left) */ } #outerWrapper #contentWrapper #rightColumn1 { background-color: #ebebeb; border-left: solid 1px #666; /* Sets the left border properties for an element using shorthand notation */ float: right; padding: 10px 10px 32767px 10px; /* Sets the padding properties for an element using shorthand notation (top, right, bottom, left) */ margin-bottom: -32767px; width: 14em; } #outerWrapper #contentWrapper #leftColumn1 { background-color: #ebebeb; border-right: solid 1px #666; /* Sets the right border properties for an element using shorthand notation */ float: left; padding: 10px 10px 32767px 10px; /* Sets the padding properties for an element using shorthand notation (top, right, bottom, left) */ margin-bottom: -32767px; width: 14em; } /* Contains the main page content. When using a mutliple column layout the margins will be set to account for the floated columns' width, margins, and padding. */ #outerWrapper #contentWrapper #content { margin: 0 16em 0 16em; /* Sets the margin properties for an element using shorthand notation (top, right, bottom, left) */ padding: 10px 10px 10px 10px; /* Sets the padding properties for an element using shorthand notation (top, right, bottom, left) */ } /* Using floated elements and a clear float class is a common method to accomplish multiple column tableless layouts. If floated elements are used without being cleared the elements following will wrap around the floated element. This class should be applied to an element after the last floated element and before the close of the container with floated elements. */ #outerWrapper #contentWrapper .clearFloat { clear: both; display: block; } #footer { background-color: #ddd; width: 650px; border-top: solid 1px #666; /* Sets the top border properties for an element using shorthand notation */ padding: 10px 0px 10px 0px; /* Sets the padding properties for an element using shorthand notation (top, right, bottom, left) */ margin: 0 auto 0 auto; } --> </style> <!--[if IE 5]> <style type="text/css"> /* IE 5 does not use the standard box model, so the column widths are overidden to render the page correctly. */ #outerWrapper #contentWrapper #leftColumn1 { width: 16em; } #outerWrapper #contentWrapper #rightColumn1 { width: 16em; } </style> <![endif]--> <!--[if IE]> <style type="text/css"> /* The proprietary zoom property gives IE the hasLayout property which addresses several bugs. */ #outerWrapper #contentWrapper #content { zoom: 1; } </style> <![endif]--> -------------- And then the page code: Code: <body> <div id="outerWrapper"> <div id="header"><img src="hockley_header.jpg" alt="" width="650" height="150" /></div> <div id="topNavigation"> <div align="center">Nav </div> </div> <div id="contentWrapper"> <div id="rightColumn1"><h2>H2 rightColumn1 Title </h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. <a href="#">More...</a></p> <hr /> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio. <a href="#">More...</a></p></div> <div id="leftColumn1"><h2>H2 leftColumn1 Title </h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. <a href="#">More...</a></p> <hr /> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio. <a href="#">More...</a></p> </div> <div id="content"><h1>H1 Main Content</h1> <hr /> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. Fusce varius urna id quam. Sed neque mi, varius eget, tincidunt nec, suscipit id, libero. In eget purus. Vestibulum ut nisl. Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut, sapien. Fusce metus mi, eleifend sollicitudin, molestie id, varius et, nibh. Donec nec libero. <a href="#">More...</a></p> <h2>H2 level heading</h2> <hr /> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio. <a href="#">More...</a></p> <p> </p> </div> <br class="clearFloat" /> </div> </div> <div id="footer">Footer</div> </div> </body> -------- Like I said, I'm completely out of my element here - learning bit by bit. CSS isn't difficult coming from a programming background, but my troubleshooting abilities are definitely not up to par. Any help on this issue is greatly appreciated. Hi, Not sure if I'm posting in the right area, but here goes. I'm trying to learn how to send HTML emails, and as I'm in the process of revamping our website using only CSS (no tables), I wanted to format the emails in the same way. I've created 2 html pages in Dreamweaver - in one, I linked to my stylesheets, and in the other I copied and pasted the contents of the stylesheets and embedded them in my html page. The incorrect result described below is exactly the same for both. In Outlook, following instructions I found on Macromedia's website, I created a New email, did Insert -> File, clicked the dropdown arrow beside the Insert button, and clicked Insert As Text. It inserts the images fine, so obviously it's finding the path I've specified (I have alternated between using an absolute path and using a relative path and a base tag) but the layout is completely wrong, eg. the 'LeftPanel' which I've specified as : #LeftPanel { position:absolute; top: 105px; left: 5px; width: 190px; height: 400px; border: 1px solid #000033 } is taking up the full width of the email - basically everywhere I've set a specific width/height are not being displayed as specified at all. I've used a browser to view the work I've done on the revamp of the actual website and everything is exactly right, so the stylesheets are working correctly in that context. Anyone any ideas what the problem is? Thanks a lot, J. A quick question about how to over-ride style on the <a> tag: I have the following css: Code: #menu a { display:block; padding:8px 12px; background:#5a5152 url(images/seperator.gif) bottom right no-repeat; color:#ccc; text-decoration:none; } #menu a:hover { background:#2580a2 url(images/hover.gif) bottom center no-repeat; color:#fff; } I want to override this for the last menu item to get rid of the separator on the last menu item on the right - but want to keep everything else. I have tried the following which does what I want but I lose the hover effect: Code: <a style="clear:both; display:block; padding:8px 12px; background:#5a5152 bottom right no-repeat; color:#ccc; text-decoration:none;" href="contact.php" title="Contact Us">CONTACT US</a> How do I add in the hover to the above override or is there abetter way to do this? I'm new to CSS, and I've been working with Wordpress. While learning CSS, I'm experimenting with various things in HTML, Php, and Javascript. I'm often finding myself wanting to override the CSS settings implemented by Wordpress. However, I don't want the settings overridden for every page - just the particular one I'm working on. In other cases, I only want the CSS overridden for a few lines of code (such as font type). This kind of problem is making me think writing customized CSS/Php is worth exploring. I spend twenty minutes coding something to spend an hour trying to integrate it with Wordpress. Is there a way to get the style sheet to let the inner tag to override the parent's tag? Seem that only one webpage need that while many other doesn't. I'll post the code below, take a look at the text-align:left ...... Code: <div style="margin:0px;padding:25px 30px;text-align:left;"> <img style="text-align:center;" src="..."> </div> I have setup a style for the <A> Tag which will be used throughout the site. Code: a { cursor:pointer; color: #8E9300; text-decoration: underline; } I have one div on one of the pages that contains some links, on this one div I would like to redefine the <a> tag or override it but not affect the <a> tags on the rest of the site. How can I do this? Thanks. Is there a way to get the style sheet to let the inner tag to override the parent's tag? Seem that only one webpage need that while many other doesn't. I'll post the code below, take a look at the text-align:left ...... Code: <div style="margin:0px;padding:25px 30px;text-align:left;"> <img style="text-align:center;" src="..."> </div> I have 2 css files. One main one that I am using Code: input[type="text"], select { background: #FFF !important; } I use that mainly for Firefox as without it the form fields are yellow. but I would like to override that have have one form field on this one page stick out and have it like this. Code: .CCfield { color: Black; background: #FFFF66; } Is this doable? How can I override it for this one field? Thanks I made a few tables using the old HTML method o setting table attributes. However I later discovered css for tables and wrote the following and it works well with some new tables i have made: Code: table { border-collapse: collapse; border-spacing: 0px; } Now all my old tables follow the above style (quite naturally). How can I override the css styles for the older tables? how do i set border-spacing to its default value? thanks Hi there. I have a print style that won't display images when printing.. img {display: none;} I have a certain page where I need the print style sheet but will like the images to print. How can I override the print style for the images? I have a CSS that manages my site, but I've got a list of links that are dynamicly created with php/mysql. I have two lists that I would like to use non-CSS colors for their links. Is there a way to override the CSS to force certain colors on the links? I've tried using the normal <p> or style settings, but the main links portion of the CSS always takes precedence and I can't seem to make it work for me. A little background for you...the lists are as follows: 1 - a list of currently open jobs in the company 2 - a list of all jobs in the company Both lists are also links to the job descriptions. List 1 is created based on whether the database has the job flagged as open, so its never static. List 2 is not static either because it lists the jobs in the database. Is there a way to override CSS padding to use cellpadding instead or can inheritance be prevented? I have a CMS and I want editors to still be able to use the cellpadding attribute rather than make a class for each desired padding. I am not able to set a defining ID or class on the table as it's generated with our CMS. The relevant tables are contained in a defined parent class. Code: TD{ padding: 0px; } .custom TD{ /*padding: ignore;*/ } Code: <span class="custom"> <table cellpadding="5"> ... </table> <span> 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? Hello, I'm an amateur with CSS, and would appreciate if you could take some time to help me out! I have a CSS rule to render all bullets in my page with a different icon, including on the sidebars. But there's one single list (a secondary navigation bar) where I do not want any bullets. I am trying to override it, but am unable to. I'd be glad if you could review my CSS and tell me where I'm going wrong. Thanks a Ton! Code: .sidebar li { border-top:dashed #cccccc 1px; } .sidebar ul li { padding:0 0 0 1.5em; list-style-type: none; list-style-image: none; background-image: url(img/menu-leaf.gif); background-repeat:no-repeat; background-position: 0.3em 0.6em; } This is my navigation block Code: #navigation-secondary a { display:block; color:#ffffff; } #navigation-secondary a:hover { background-color:#369; /* to change color when hovered over */ } The following method to override it doesn't work Code: #navigation-secondary , #navigation-secondary ul, #navigation-secondary ul li, #navigation-secondary a { list-style-type:none; list-style:none; } ul.secondary-links li, ul.secondary-links ul li { background-image:none; border-top: none; } I should mention, the top border has been overridden, but not the background image. My html code snippet (rendered via php) is here Code: <div class="sidebar" id="sidebar-left"> <div id="navigation-secondary"> <ul class="links secondary-links"> <li class="menu-138 first"><a title="Link1 site" href="/link1">Link1</a></li> <li class="menu-139"><a title="Link2 site" href="/link1">Link2</a></li> <li class="menu-140 last"><a title="Link3 page" href="/link1">Link3</a></li> </ul> <div style="clear: both;"/> </div> I'd be glad if you could help me out. Thanks! Hi, I'm wondering if it is possible to override style settings in an external html document. I'm using the <--#include file command to include a html file. I don't want to modify the html file, because people (here at work) are making documents in word9 and save it to html. The major problem is that the <hr> line is too long and so is the text, so it don't fit on our website, at this point these documents are opened in a new window, but it would be nicer to intergrate them into our site. thanks -Dan Hi, I have a HTML page linking to a CSS file in the header. My main table is defined using class="formBody". This includes: Code: table.formBody td { border-width: 1px 1px 1px 1px; padding: 5px 5px 5px 5px; border-style: solid solid solid solid; border-color: black black black black; background-color: white; -moz-border-radius: 0px 0px 0px 0px; } I need to override this on certain cells, so that a SINGLE certain cell will not have any borders (these will be cells on the bottom row, so the table will have the appearance of having half of its' actual width on the bottom row). Any ideas? I tried explicitly setting border="0" in the <td> tag and also defining a new class called "noborder" with border set to none, and then using <td class="noborder"> but neither of these work. essentially, what I want, is a table that looks like: Code: ________________________ | | | | ------------------------ |________| Any suggestions on how to do this? Hey All, It's been a while, and my CSS knowledge is a bit rusty (not that it was ever all that;-). Anyway... Working on a custom wordpress admin write panel, I have a table with dynamic classes in a helper.css for indicating row status(includes .myclass tr:hover), which works great everywhere EXCEPT in our old friend IE6. Turns out that the wordpress "global.css" for admin panels defines the following: Code: html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,bi g, cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt ,dd, ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td { margin:0;padding:0;border:0;outline:0;background:transparent;} where, though I can't remember how I stumbled onto it, upon removing "background:transparent;" in wp admins global.css everything is hunky dory in IE6 too -- ok, not the tr :hover{ because IE6 only supports :hover on <a>s. but at least the row classes are displayed with no other discernible impact on this or any other admin pages in IE6 or any other browser. Of course, I don't want to go changing wordpress core code just to scratch my little itch, but I was hoping someone might suggest a means of overriding the background:transparent in wp admins global.css either in my own helper.css or in the on the page itself? I dont think you can wrap a <div> inside <a>, but is there any way to make an entire <div> area "linked" ? One idea - Im sure i can hook up an onclick event with javascript, but how would i change the mouse prompt when the user moves thier mouse over it ? Kinda new, bear with me. I have a linked image, and want to add a simple black border w css. I have this coded in an external .css: .rr25 { border-style: solid; border-width:2px; border-color: #000000; } And this is what is in my HTML: (page is linked to external .css) <tr> <td valign="top" align="center"> <a href="photo_gallery/clients/gallery_8.jpg" target="mainpic"> <div class="rr25"> <img src="photo_gallery/clients/gallery_8.jpg" width="80" height="107" border="0"> </a> </td> </tr> OK. The image displays but it is centered with tons of white space on the left and right and a small margin on the bottom. The margin grows/shrinks when I adjust the table width prop. ??????? |