CSS - Css Style Mutlple Tags
i have some css that i want to be able to change the background colour of an input box (type: text) and a textarea
this is the style for the textbox: Code: table#form tr.error input { background-color:#FFB7B7; } which works, but when i try: Code: table#form tr.error input, textarea { background-color:#FFB7B7; } it seems to ignore the names before textarea, and is effectively doing this: Code: textarea { background-color:#FFB7B7; } any ideas on a fix? is it just something with textareas? Similar Tutorials<div style="blah"> What would be used to put :hover in the style tag in place of 'blah'? ok easy one. basically i have a links outside a div and inside a div called footer. how do i do it so that the links inside the footer div dont take the css style of the one outside? i am trying to do: #footer.a:hover { } and tried a:hover#footer but it aint working? edit never mind!!! I'd like to do something like this: Quote: <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#666666" width="100%"> <tr> <td>Test</td> </tr> </table> But I don't want to use an inline style tag. I tried this: Quote: <html> <head> <style> .border { border-color: #666666; border-collapse: collapse; border: 1px; } </style> </head> <body> <table class="border" cellpadding="0" cellspacing="0" width="100%"> <tr> <td>Test</td> </tr> </table> </body> </html> But it does not work. What am I doing wrong? I am using style sheet for fonts etc. I was wondering is it OK to use style sheet and <Font> tags at the same time on a page. I mean if you are using certain font only once. Why bother creating a class in style sheet and then calling using that class .. In my main CSS file, the background-color is set to #FFFFFF (white) however this also erased my background images in the cells of my table i have tried to add them with style tags, but the main CSS still overrides Top of the table + cell with bg PHP Code: <table cellpadding="0" cellspacing="0" border="0" align="center"> <tr> <td width="766" height="295" valign="top" style="background-image:url(images/row1.gif); background-repeat:no-repeat "> This is the main CSS: PHP Code: body,td,th { font-family: Tahoma; font-size: 11px; color:#5D5D5D; background-color:#FFFFFF; } body { font-family: Tahoma; font-size: 11px; color:#5D5D5D; background-color:#FFFFFF; } Hello Everyone @ Devshed, I'm trying to improve my limited CSS skills and have a few simple questions which would really help clean up my HTML. I haven't been able to find the answer in the excellent CSS resources in the sticky (if you haven't already they are worth checking out), or in past questions so here is a new post. I understand it is possible to set styles for html tags which then apply to all document elements without having to specify a class in the actual html, so a style sheet looking like, table {border: 1px solid #000000; background-color: #EEEEEE;} th {font-weight: bold;} td {font-size: 10px;} .... Applies to a table such as the one below without having to specify a class attribute in each element. <table> <th>Title</th> <td>Cell </td> </table> I have 8 small tables on a page and would like to specify each with a unique style. A example styling could be table .style1 {border: 2px solid #000000; background-color: #CCCCCC;} th .style1 {font-style: italic;} td .style1 {font-size: 12px;}, Is there anyway I can re-write the style sheet declarations so that I declare the style I want to apply to the entire table just the once? As opposed to writing class='style1' in each table element (see below). Are ID's usefull here? <table class='style1'> <th class='style1'>Title</th> <td class='style1'>Cell</td> </table> Thanks in advance for your time, Peter I am just wondering if there is a way to simply extend a style rule from one previously defined. For instance, if I have this rule: Code: .textarea-box { color: #990000; background-color: #fff; width: 375px; height: 200px; border: #000 solid 1px; } ...if I want another text area rule to be the same except for one difference, the height should be 80px, do I have to write the rule out again with a new name, incorporating the new height, or is there some nifty way to just change the height in the new rule? Thanks for help with this. j9 I have a menu bar made up of <a href> elements that have a hover style of:
PHP Code: #mainMenu a:hover { color:#000000; background-color: #66c74c; padding: 1px 4px 1px 4px; margin: 1px 1px 1px 1px; } This will provide a green colored rollover visual as the user moves their mouse over the menu bar. I just added some JS today that will highlight the clicked (selected) menu so there is visual feedback of the section the user is in. For some reason, after setting the background color of the <a href> and color attributes, the HOVER: no longer functions. Here is the code to do the hilite where I pass the ID of the <a href> menu selection in the variable "menu": PHP Code: //--- Simplify setup by creating an array of the menus and hilight ID's --- var menus = ["menu1","menu2","menu3","menu4","menu5", "menu6","menu7","menu8","menu9","menu10"]; function J_hiliteMenu(menu) { //--- first make sure all the menu are hidden and unhilited --- for(i=0; i < menus.length; i++) { if (menus[i] == menu) theIndex = i; // Hold on to the chosen index position var obj = document.getElementById(menus[i]); if (obj == null) continue; // if menu is not available skip it obj.style.color = "#ffffff"; obj.style.backgroundColor = "#234fd7"; } //--- hilite the menu we're interested in --- var obj = document.getElementById(menu); obj.style.color = "#000000"; obj.style.backgroundColor = "#f8f400"; } Prior to hiliting the menu I un-hilite all the menus (since we may be switching from another). I think this is where the problem is. Maybe I need to redefine the rollover "hover" attribute for all elements during the un-hilite loop? Does anyone know how to set a HOVER: attribute using JavaScript? Thanks! Hi, I have some code that looks like this . #nav,#nav ul which puts all the listed elements in a vertical list. Now if I do ths #nav ul.. this changes all the elemnts to a horizontal list. What does the ',' do for the id css tags exactly as i thought it refered to nested <ul> lists but is doesn't. I've used css to change my alt tag text to be consistent in size and font to the rest of the site, however, a couple of my images are relatively thin, but are tall. It seems that the alt tags get centered to the image, so you only see the middle of the tag, not the beginning and the end. Is there a way to wrap the text within the confines of the image. Thanks. Hi, i have to display a list of links horizontally, wrapped in a <ul> tag. For seo reasons now these links have to be wrapped in <h2> tags. In IE6 + IE7 this causes a linebreak and the links are displayed in a vertical list. sth like #myId LI { display:inline-block; } #myId LI H2{ display:inline-block; } solves the problem for Firefox but not for IEs. Do you know a solution? Would be highly appreciated! here the html <ul id='myId'> <li><h2><a htref=...>somewhere</a></h2></li> <li><h2><a htref=...>somewhere</a></h2></li> </ul> OK Found out a float:left in the li was missing Hello, I've been messin with this all night but just can't get the result i'm after. The bit of code which follows, almost works - except the fields on the right hand side don't align to the top (to be in line with the top of each text on the left). What am I doing wrong? Can anyone please help me? Thanks, JT EDIT: Screenshot of the current output is attached too for information Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Test Document</title> <style type="text/css"> div.configset label { font-weight: bold; } div.configset fieldset { background-color:#FFE391; border:1px solid; margin:0.5em 0.5em 0.5em 0.5em; } div.configset dl { font-size: 0.85em; width:100%; } div.configset dt { float:left; border-right: 1px solid #FFCC6F; width:45%; padding:0.5em 0.5em 0.5em 0.5em; } div.configset dd { clear:both; margin: 0 0 0 46%; padding:0.5em 0.5em 0.5em 0.5em; } </style> </head> <body> <form id="form1" method="post" action=""> <div class="configset"> <fieldset> <legend>General Options</legend> <dl> <dt> <label for="conf_13">Website Enabled</label><br /><span>Toggle the website on and off. Note that no part of the website (except admin functions) will work if this is set to False.</span> </dt> <dd> <input type="checkbox" name="conf_13" id="conf_13" checked="checked" tabindex="1" /> </dd> </dl> <dl> <dt> <label for="conf_1">Website Name</label><br /><span>Name of the website. Appears in title of browser and some links</span> </dt> <dd> <input type="text" name="conf_1" id="conf_1" size="40" maxlength="50" tabindex="2" value="Kinetic" /> </dd> </dl> </fieldset> <fieldset> <legend>Login Options</legend> <dl> <dt> <label for="conf_7">Login Attempts</label><br /><span>Amount of login attempts before time delays start occurring to prevent forced access</span> </dt> <dd> <input type="text" name="conf_7" id="conf_7" size="2" maxlength="2" tabindex="6" value="3" /> </dd> </dl> <dl> <dt> <label for="conf_8">Login Failure Delay</label><br /><span>Amount of time (in minutes) to delay a member from logging in with the failed account details</span> </dt> <dd> <input type="text" name="conf_8" id="conf_8" size="2" maxlength="2" tabindex="7" value="5" /> </dd> </dl> </fieldset> </div> </form> </body> </html> I'm sorta new to CSS-positioning so some of the code looks jumbly. But I'm trying to make the page work in mozilla's firefox and in the process of doing that I broke it in IE. Anyways, here is the link to the buggy page that the div containers hop all over the place. If you hit refreash enough you will see the lower section that displays the extra news articles will lose its left-margin setting and hop around. Plus it drops the archive container down below the extended news section as if they widths are clashing when they appear fine in firefox. I'm assuming there is probably some type of ie bug and I'm curious if someone has a link to a hack for it? Could use any help I am having a heck of a time with this side sub-menu. I cannot seem to get the left margins to be equal in IE 6, 7 or 8? My html: Code: <!-- show_menu2 --> <ul id="sub_menu" class="menu" style="margin-left:-5px;position: relative; background-color:#CFF"> <li><a href="#" class="menu-expand menu-first navlev2" title="Project">Add-ons Project</a></li> <li><a href="#" class="menu-expand menu-parent navlev2" title="What Modules">Modules</a> <ul class="ullev3"> <li><a href="#" class="menu-sibling menu-first navlev3" title="Modules Here">Module</a></li> <li><a href="#" class="menu-sibling navlev3" title="Admin Tools">Admin Tools</a></li> <li><a href="#" class="menu-current navlev3" title="Random">Code Snippets</a></li> <li><a href="#" class="menu-sibling menu-last navlev3" title="Droplet of Link">Droplets</a></li> </ul> </li> <li><a href="#" class=" navlev2" title="AMASP">AMASP</a> </li> <li><a href="#" class=" navlev2" title="Templates">Templates</a> </li> <li><a href="#" class="menu-last navlev2" title="Backend Pages">Backend Themes</a></li> </ul> </div> <!-- end of subnavigation --> My CSS: Code: #submenu { padding: 0; /* [disabled]width: 247px; */ /* [disabled]position: relative; */ /* [disabled]left: -15px; */ } #submenu a { text-decoration :none; color :#5b9acf; padding-left :12px; display :block; background-image: url(../images/bullets_micro/square3.gif); background-repeat: no-repeat; background-position: 2px 50%; } #submenu a:hover { color :#003366; background-image: url(../images/bullets_micro/square1.gif); background-repeat: no-repeat; /* [disabled]background-position: 4px 50%; */ } #submenu a:active { border: none; } #submenu a.menu-current { font-weight :bold; color :#003366; background-image: url(../images/bullets_micro/asst3.gif); background-repeat: no-repeat; background-position: 4px 50%; } #submenu ul { margin-top: 0; margin-right: 0; margin-bottom: 0px; /* [disabled]margin-left: -25px; */ /* [disabled]position: relative; */ /* [disabled]left: -10px; */ } #submenu ul li { padding :5px 0; /* [disabled]line-height :1.4em; */ font-size :12px; list-style-type :none; border-bottom :#cccccc 1px solid; } #submenu ul li.a { padding: 0px 10px; } #submenu ul li li { border-bottom :none; padding-bottom :0px; font-size :11px; } #submenu ul li li a:link, #submenu ul li li a:visited { color :#003366; background-image: url(../images/bullets_micro/diamond4.gif); background-repeat: no-repeat; background-position: 2px 50%; } #submenu ul li li a:hover { background-image: url(../images/bullets_micro/diamond.gif); background-repeat: no-repeat; /* [disabled]background-position: 4px 50%; */ color: #6DB9FA; } /* ====================== */ My test page: (pardon the blue background I just added this to see the container.) http://new.ssmarts.org/page.html Thanks so much. Hello! Can anyone help me with this one... I'm trying to figure out how to change the following css/html (or if it's even possible) so it still works after removing the surrounding <span> tag. (There is additional javascript which shows/hides the div but I've removed it so it's simpler to read). So the current html below would be shortened to: Code: <a href="javascript:void(0);" class="sddm"><u>Settings</u> <div id="m1" class="alignl"> <a href="#">HTML Drop Down</a> <a href="#">DHTML Menu</a> <a href="#">JavaScript DropDown</a> <a href="#">Cascading Menu</a> <a href="#">CSS Horizontal Menu</a> </div> </a> ORIGINAL CSS/HTML: Code: <style type="text/css"> /* Drop Down Menu */ span.sddm { z-index: 30; white-space: nowrap; position: relative; } span.sddm a { text-decoration: none; } span.sddm a:hover { text-decoration: none; color: blue; } span.sddm div { position: absolute; display: none; margin: 0; padding: 0; background: #fff; border: 1px solid #3366cc; border-top: 1px solid #c9d7f1; border-left: 1px solid #c9d7f1; top: 18px; } span.sddm div a { position: relative; display: block; margin: 0px; padding: 2px 5px; width: auto; text-align: left; text-decoration: none; white-space: nowrap; } span.sddm div a:hover { background: #3366cc; color: #fff; } span.sddm .alignl { left: 0px; } span.sddm .alignr { right: 3px; } </style> <span class="sddm"> <a href="javascript:void(0);"><u>Settings</u> <small>▼</small></a> <div id="m1" class="alignl"> <a href="#">HTML Drop Down</a> <a href="#">DHTML Menu</a> <a href="#">JavaScript DropDown</a> <a href="#">Cascading Menu</a> <a href="#">CSS Horizontal Menu</a> </div> </span> Hello: I am working on a website and cannot for the life of me figure out why the element called "innerloop" keeps appearing behind the menu element "nav". here is the html so far: Code: <title>Casa Grande Acclaim Realty</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="" /> <meta name="keywords" content="" /> <meta name="robots" content="index,follow" /> </head> <body> <div id="main"> <div id="border"></div> <div id="contact_info"> <p>Casa Grande Acclaim Realty<br/> 11283 N. Henness Road<br /> Casa Grande, Arizona 85194 <br /> Phone: (520) 560-8366 <br /> Fax: (520) 421-1444 </p> </div> <div id="logo"></div> <div id="slogan"> Serving All of Pinal County </div> <div id="nav"> <ul> <li><a href="#">About Us</a></li> <li><a href="#">Our Listings</a></li> <li><a href="#">FAQs</a></li> <li><a href="#">Contact</a></li> </ul> </div> <div id="innerloop"> lorem ipsizzum fo shizzle my bizzle Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah Blah blah blah blah blah blah blah </div> </div> </body> </html> And this is the css: Code: #main { width: 875px; background-color: white; border-style: inset; border-color: #800080; margin-left: auto; margin-right: auto; -moz-box-shadow: 5px 5px 5px 5px #008080; -webkit-box-shadow: 5px 5px 5px 5px 008080; box-shadow: 5px 5px 5px 5px 008080; -ms-filter: } #logo { width:300px; height:170px; padding:0 0 0 0px; background:url(redonelogo.bmp) no-repeat; } #contact_info { color: #800080; font-weight: 550px; font-variant: small-caps; font-size: 14px; float:right; padding-top:0px; padding-right:10px; } #border { width: 875px; height: 57px; background-image: url(border.bmp); background-repeat: repeat-y; } #slogan { float: right; font-variant: small-caps; margin-right:20px; padding-top:0px; font-size:18px; font-weight: 800px; text-align:right; color:#800080; } #nav { width: 875px; float: left; margin: 0 0 1em 0; padding: 0; list-style: none; font-variant: small-caps; background-color: #FFFF00; border-bottom: 1px solid #008080; border-top: 2px solid #008080; margin-top: 10px; } #nav li { float: left; } #nav li a { display: block; padding: 8px 15px; text-decoration: none; font-weight: bold; color: #008080; border-right: 1px solid #ccc; } #nav li a:hover { color: #800080; background-color: #fff; } #innerloop { width: 860px; background-color: white; margin-left: auto; margin-right: auto; border-style: double; border-color: #800080; border-width: medium; } I am rusty and stuck I took out the html header stuff and stylesheet link to conform to forum rules Thank you I have some listing text that comes from a database, displayed in a column. Each block of text is enclosed in a DIV tag. I use the following to cause the area of the text to change background color when there is a mouseover: Quote: div.list { padding: 5px 5px 5px 5px; } div.list:hover { background-color: #FFFACD; } Works fine for Firefox, but doesn't do anything in IE. How can I fix this so it works in IE as well? Im trying to control how the text formats within a div tag, that sits inside a menu. The text appears when you rollover the items in the submenu and I want extra information to appear but when it does, it doesnt wrap 'correctly' I have the menu sitting he http://www.electronical.org/tmp/playsongs/ If you rollover 'Products > playsong titles', you will see some blue text appears at the bottom of the submenu. How do I format this so it is the width of the submenu and wraps to the length of it? Thanks for any help. Hi there, this is concerning 'id' tags...i've got a style set for my <a> tags, and i wish to create a second <a> style, to be applied to a small set of the <a>'s in my site. I know the #blah should be used to set an id for it, but here's my concern; 1. where do i state the id for the <a>? (ie. <div id="blah"> or <a href="http:///////" id="blah">). 2. do i need to define an id for the existing style? or can i just leave it the way it is and apply the id to the one i want different? thanks in advance. |