CSS - One Element With Multiple Class Names ..
Hello everyone, l just wanted to know what browsers support the following:
Code: <style> td.test1 { background-color: pink; } td.test2{ border-style: dotted; border-width: 10; border-color: orange; } </style> <table> <tr><td class="test2 test1"> THIS IS A TEST .. YAYA!! </table> Which is 1 element, with 2 class names... It seems to work with the latest netscape, IE, and opera, just wanted to know if this is something l should be using on my web pages, or not due to the possible compatibility issues, any help is greatly appreciated, gents Samantha Gram. Similar TutorialsHi, I was just wondering whether it is valid to use the following names in CSS for classes or ID's Code: .class1 .class2 #id3 #id4 Are alphanumeric names allowed? Can you have the a class name as follows: <tr class="row one"> . Hey, I just started learning all of this stuff, and I had a question. I'm trying to set it up so that in my CSS I have two different sets of styles for links. Technically they are the same styles, I just want this class and this other class named differently, and it wont let me. It keeps taking the second one back to default. Is there a way I can get around that and get it to work? Thanks, JennyO I have an asp page that displays some text which is formatted by a stylesheet. The colour of the text box depends on the text itself. For example, the information displayed is a risk. If the risk is 'None', the box is white, if it is 'High', the box is red, etc. The class is determined programmatically, according to the actual risk. In the stylesheet I have a class called 'None', another called 'High', etc. The problem I have is that one of the risks is 'No Risk' which obviously has a space in it. The text MUST say 'No Risk' so the solution is not to have text with no space in. How do I create a class in my stylesheet called No Risk? If I type it literally, with the space, it doesn't recognise it. I have a procedure that selects the Risk from a database table. The asp page has the following line to set the class: Response.Write "<td class=" & chr(34) & Replace((rs.Fields.Item("risk").Value) , " ", "") &"2" & chr(34) & ">" & (rs.Fields.Item("risk").Value) & "</td>" Any help would be very gratefully receive it as I am rapidly running out of hair! Thank you. i've been searching the web for a couple weeks trying to find a simple way to swap CSS classes onMouseOver, making a simple, and elegant Rollover button. i've found tons of examples with really complex methods, but i really need to do it with CSS classes. so i've read repeatidly that by putting the following code as your TD tag you'll be able to change class names. and it simply doesn't work at all. the code i'm having a problem with reads like this: <td class="out" onMouseOver="this.className='over'" onMouseOut="this.className='out'"> it just doesn't work. anyone at all who can give me a code that does work, i'd be more than appreciative. oh, and by the way i'm using IE 6.0.2600 hi all ... i am trying to hide the link of "Price" and "Broker" from the class "CONTENT" ... however it doesnt work with it . What wrong with my code? i am a new css learner ... sorry for troublesome ... CHEER <html> <head> <title>Stock</title> <meta http-equiv="Content-Type" content="text/html; charset=big5" /> <style> .CONTENT:link {display : none ! important;} </style> </head> <body> <tr class="MarkColor3" valign="top"> <td class="CONTENT" valign="top" width="35"> 1234</td> <td class="CONTENT" valign="top" width="140"> XXX Cop. Limited </td> <td class="CONTENT" valign="top" width="55"> 5.050</td> <td class="CONTENT" valign="top" width="58"> <img src="../images/index_up.gif" />0.075</td> <td class="CONTENT" valign="top" width="58"> <img src="../images/index_up.gif" />1.508%</td> <td class="CONTENT" valign="top" width="69"> 707,730,172</td> <td class="CONTENT" valign="top" width="198"> | <a href="../a.html">Price</a> | <a href="../b.html">Broker</a> | </td> </tr> </body> </html> hi all I've got a styled ul+li element, and I've put a new color class in a span tag, for a link li a, li a:active, etc { color: #00FF00; } li a:hover { color: #00AA00; } spanclass a, span a:active, etc { color: #00FF00; } spanclass a:hover, etc { color: #00AA00; } <li>hello, <span class="spanclass"><a href="#">this is a link</a></span></li> Except it's completely ignoring the span class colors... Anyone know why? I'm making a page with what amounts to footnotes 1 . Some sources may be referenced more 2 than 2 once 2 , and when any of them is hovered over, I'd like all items in the same class to be highlighted 3 , so when i hover over this little number three 3 , I want this next number three 3 and the actual reference down below to all change color. Is there any to do this without using javascript? (I don't care if it doesn't work in IE6 - I know that has hover issues... 4 ) 1 - Like This! 2 - that one was used 3x 3 - This is red and so are all the little #3's up there 4 - I'm just using Firefox I'm just pondering over the performance differences between having a flexible css sheet which requires the html to call several classes for the desired effect, against having each element specifically styled and therefore having code repetition... ie; CSS: Code: .emphasise{ color:#ed5200; } .txt_bold{ font-weight:bold; } .txt_big{ font-size:2em; } HTML: Code: <div class="emphasise txt_bold txt_big">Hi there!</div> <div class="txt_big">I'm not as bold</div> ----- or this method ----- CSS: Code: .title{ color:#ed5200; font-size:2em; font-weight:bold; } .sub-heading{ font-size:2em; } HTML: Code: <div class="title">Hi there!</div> <div class="sub-heading">I'm not as bold</div> Hi! i want to create textblock titles which consist of more than one color.... like this: hello per son ! so i want a certain part of the users name to be green and a certain part red.... first 30 % of the name and last 70% something like that... or is this only doable by breaking up the username and apply 2 classes to it? would be nice if doable in CSS, saves a lot of work.... thanks!!! Hey guys, I'm hoping what I need to do involves only CSS (though, it wouldn't shock me if I needed a lot more!) Anyways, the basic thing I'm doing is a table that hold lots of numbers. I'm creating a "times table" - which looks roughly something like this: ......1 2 3 //top row (multiples) 1.....1 2 3 2.....2 4 6 3.....3 6 9 Now, when you rollover, let's say, the '6' - the TD background color for the '6', left '2' and top '3' would change to a different color (bolded in this example). This would work the same way for every other number as well, which involves overlapping classes. I can only get one rollover working, with simple 'hover' commands. I've search for an answer for hours, to no avail. any suggestions? And here's a more "code specific" example of the table: <table> <tr> <td>1</td><td>2</td><td>3</td> </tr> <tr> <td>1</td><td>1</td><td>2</td><td>3</td> </tr> <tr> <td>2</td><td>2</td><td>4</td><td>6</td> </tr> <tr> <td>3</td><td>3</td><td>6</td><td>9</td> </tr> </table> Thanks so much guys! Hi, My page has 3 elements: one at the top(header banner), one in the middle (a middle content area) and one at the bottom (footer banner). Now I want those positions to remain intact regardless of the number of lines output in the middle element. The content is going to be determined at runtime by a server-side routine so I don't want to use a fixed positioning for the footer banner. I want it to be displayed at the bottom - after the middle content is displayed. And I want the middle content to be visible in the page i.e. I don't want a scroll area within the page. I have tried various approaches and read up on positioning but so far have not been able to do it using css. Any help is much appreciated. Jim I have an navigation menu that I am building as an unordered list. What I have is an image rollover that appears at the bottom of the navigation menu when the cursor hovers over one of the first level links by using a span within the link that has its display set to none, and then set to absolute positioned directly below the navigation menu on a:hover. Here is an example: Code: <ul> <li> <a href="link1.html" id="link1">Link<span></span></a> </li> </ul> .link a { some link height } .link a span { display: none; } .link a:hover span { position: abolute; top: (some link height * the number of links); background-image: (some image url) width: (image width) height: (image height) } Appearance: ------ Link1 Link2 Link3 Link4 ------- ------- Rollover Image to appear here ------- The problem that I have is that since the rollover image is positioned absolutely, if the size of the list of links changes (IE with sub-links in the list) it slides under or over where I have the rollover image placed. IE ------ Link1 sublink1 sublink2 Link2 Link3 Link4 ------- will break my scheme. Is there a way to get the span within the link to show up relative to the bottom of the <ul> element, or at the bottom of an element that contains the whole shebang? If I cant get this to work, I'm going to be forced to adopt the existing tables/javascript based template for our site, and I'd hate hate hate to do that. thanks. hey, I got a table, every <td> in the table got the css class .regular. (<td class='regular'>). When the user moves their mouse over a row, that row should change color. This works with the following code: <tr onmouseover='this.className=\"hoverRow\"'> However, this only works if the td's in that row have no class set yet. And since all td's in my table have a class set allready, i cant use this. How can i overwrite the class of the td's by the class for the whole row? thanks in advance Using the following example: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test</title> <style type="text/css"> a { display: block; } a.one.on, a:hover.one, a:hover.one.on { color: red; } a.two.on, a:hover.two, a:hover.two.on { color: orange; } a.three.on, a:hover.three, a:hover.three.on { color: green; } </style> </head> <body> <a href="#" class="one">one</a> <a href="#" class="two">two</a> <a href="#" class="three">three</a> <p> </p> <a href="#" class="one on">one</a> <a href="#" class="two on">two</a> <a href="#" class="three on">three</a> </body> </html> Notice how, in IE6 (works fine in FF), when the secondary style named 'on' is added, all 3 links in the 2nd set display the properties of the style: Code: a.three.on, a:hover.three, a:hover.three.on { color: green; } (since it is last in the list) rather than the style specified by their respective numbers (i.e. 'one', 'two' or 'three'). Is there a way to overcome this in IE. I've read several forums and know that the technique I'm trying to achieve is possible, however I can't seem to get it to work. Basically I'm trying to shift the background positions of both the list item I'm hovering over and the next list item. I'm sure its just a syntax error and not a logic error, anyways the code is below - any help would be greatly appreciated! Code: HTML Code <div class="menu"> <ul> <li><a href="#" class="search"></a></li> <li><a href="#" class="battery"></a></li> <li><a href="#" class="cart"></a></li> <li><a href="#" class="contact"></a></li> </ul> </div> CSS .search, .contact, .cart, .battery { width:100px; height:30px; margin-left:-1px; display:block; } .search { background-image:url(Images/search.png); } .contact { background-image:url(Images/contact.png); } .cart { background-image:url(Images/cart.png); } .battery { background-image:url(Images/battery.png); } ul li a.search:hover { background-position:0px 60px; } ul li a.search:hover ul li a[class=battery] { background-position:0px 60px; } Can anyone explain the difference between the two? For example, what is the difference between: this: element element {} div p { } and this: element > element { } div > p { } I don't understand it and have not found an explanation in tireless searching. Thx! Howdy, Does anybody have, or has anyone ever seen a table for any form of database with CSS color names and/or hex codes in it? I'm sure some web design sites have something like it, but I could be wrong. If I don't get a reply in a couple of days, I'll go ahead and make my own and make it publically available (most likely in Access format). Thanks in advance. -colin Hey guys, I'm SURE this has been asked before but I just can't find it. Is there any way to use a * in a selector name to match multiple selectors? Something like this: Code: row* { padding-top: 10px; } Which would match all of the following: Code: <div id="row1"> ... </div> <div id="row2"> ... </div> <div id="row3"> ... </div> I'm thinking there's not, as the code above doesn't work. I'm thinking that the only alternative for dynamic ID names is in-line CSS styles, but I figured I'd ask just in case. Thanks in advance |