On CSS Polymorphism (not about WoW at all)
As the title says, this isn't about WoW or tanking at all. I'm a web developer by trade, and I've been running into this issue with Cascading Style Sheets and how CSS rules are overridden. I don't really have a place I can tell people about things I find out about web development and design and the various technologies associated with it, but I have this 'blog. I know some of you deal with CSS and such on a regular basis, and this might be useful for somebody out there.
So, to start out, here's some HTML structure. It's fairly standard structure, though greatly simplified. I won't include any CSS at this point, I just want to show what kind of HTML I'm working with.
So, we have a container element with some divs in it. Some have a class that sets them apart from the others, so they can be styled differently. Let's see what we can do about that style.
This says that all divs within the container div should have a solid, black, 1 pixel border, and all elements with the .test class should have the same border, but red. Simple, and straight-forward, right? Not quite. Since the first rule matches all the divs with the .test class, and includes the ID of an element, it won't be overridden by the less-specific second rule.
It's odd, but true. Give it a try sometime.
EDIT: I may have just secured my nomination for 'biggest geek'. What with posting about the oddities of CSS on my WoW tanking blog.
EDIT2: Changed my description and the CSS to the right class names.
So, to start out, here's some HTML structure. It's fairly standard structure, though greatly simplified. I won't include any CSS at this point, I just want to show what kind of HTML I'm working with.
<html> <head> <title>Testing CSS</title> </head> <body> <div id="container"> <div></div> <div class="test"></div> <div class="test"></div> <div></div> </div> </body> </html>
#container div {
border: solid black 1px;
}
.test {
border: solid red 1px;
} It's odd, but true. Give it a try sometime.
EDIT: I may have just secured my nomination for 'biggest geek'. What with posting about the oddities of CSS on my WoW tanking blog.
EDIT2: Changed my description and the CSS to the right class names.
Total Comments 2
Comments
| | Wierdness like this is why I use a hybrid of tables and divs for my layouts. inheritance with CSS is random from browser to browser, so I work to create a situation where there is no inheritance at all. ![]() |
Posted 11-07-2008 at 10:30 AM by Alent |
| | Pure CCS myself. Although for my WoW blog, I just let Wordpress do all the work for me. |
Posted 11-07-2008 at 01:43 PM by veneretio |
Recent Blog Entries by Thireas
- Alas, Poor Macros... (01-02-2009)
- On CSS Polymorphism (not about WoW at all) (11-07-2008)
- ZA Cleared! ... twice (10-31-2008)
- Grats to the Mageroyal Syndicate (10-24-2008)
- "Rotation" (10-19-2008)







