css-selectors

How to only show certain parts with CSS for Print?

I have a page with lots of data, tables and content. I want to make a print version that will only display very few selected things. Instead of writing another page just for printing, I was reading about CSS's feature for "@media print". First, what browsers support it? Since this is an internal feature, it's OK if only the latest brow...

Are there any known issues with putting invalid CSS characters (@,:,!) in the class attribute of a HTML element?

I wrote a comparison validator, that compares two inputs values. Originally in tried using the primary input's name attribute to store the secondary inputs id. //example: does not work in IE7 <input id='txtPrimary' type='text' class='compare' name='txtSecondary'/> <input id='txtSecondary' type='text' /> This work in every browser exc...

CSS - using :hover on elements other than links...

Hey, For ages now my site has had a catalogue where the small image is directly within a link within a div. The link must only be around the image - but I do not want to use the + selector since this is not supported by some versions of IE (IE6 onwards I think it needs to support). The div has class "ImageHoverSpan" (it used to be a Spa...

In CSS, a way to say, if the TD element has IMG in it, then "text-align: center"?

The line td img { text-align: center } won't work. It has to target the td instead: the td having an img element will have text-align: center. Can it be done in CSS 2.1? ...

Making a SASS mixin with optional arguments

I am writing a mixin like this: @mixin box-shadow($top, $left, $blur, $color, $inset:"") { -webkit-box-shadow:$top $left $blur $color $inset; -moz-box-shadow:$top $left $blur $color $inset; box-shadow:$top $left $blur $color $inset; } When called what I really want is that if no $inset value is passed, nothing is output, r...

CSS :active pseudo class - target child elements in IE

I'm making a fancy button that has hover and click effects. The button looks something like: <a class="redB"> <span class="a">&nbsp;</span> <span class="b">Email Us</span> <span class="c">&nbsp;</span> </a> My problem is in trying to access the three span elements in my css like this: .redB:active span.a{background-position:0 -432...

problem with <select> and :after with CSS in WebKit

Hi, I would like to add some style on a select box with the pseudo :after (to style my select box with 2 parts and without images). Here's the HTML: <select name=""> <option value="">Test</option> </select> And it doesn't work. I don't know why and I didn't find the answer in the W3C specs. Here's the CSS: select { -webkit-appea...

CSS Selector for Absence of Tag

Given this HTML: <div class="entry"> <a class="meta">Aug. 20, 2010</a> <div class="content"> <h2><a href="#">Hello.</a></h2> <p>...</p> </div> </div> <div class="entry"> <a class="meta">Aug. 20, 2010</a> <div class="content"> <p>...</p> </div> </div> And this CSS: .entry{ width: 760...

Is there any reliable way of accessing specific elements of Gmail from inside a userscript?

I'd like to make a script that replaces either the Notes box in the contact page, or the sidebar of a conversation thread, with content pulled from my server, very similar to the way Rapportive (http://rapportive.com/) works. I'd even like to be able to grab the email address of the person being looked at or emailed with, the way they do...

Getting all visible elements using MooTools

Hi, I am moving from jQuery to MooTools (for the fun..) and I have this line of code : $subMenus = $headMenu.find('li ul.sub_menu:visible'); How I can write this in mootools? I know that I can use getElements but How I can check for visible ul?(I am using this(:visible) selector a lot). Edit - I implemented my own function : f...

JQuery selector help

Using JQuery, how do I select all elements with class x within an element with id y? ...

How can i duplicate a CSS style?

On the .master file i have... <div id="menu"> <ul> <li class="1"><a href="#">One</a></li> <li><a href="#">Two</a></li> </ul> </div> <div id="Div1"> <ul> <li class="1"><a href="#">Three</a></li> <li><a href="#">Four</a></li> </ul> </div> and on the css file i have #menu { width: 940px...

does the order of styles matter?

hello, below is my markup. when i move the mouse over the hyperlinks they get underlined and turn red. but if i swap the order of the last two rules, the hyperlinks still get underlined, but their color changes to black rather than red. is this by design? if so, how are the rules applied? thanks! konstantin <?xml version="1.0" encodi...

styling alternating rows in a table

hello, is it possible to set the style of alternating rows in a html table with style selectors that only take account of the hierarchy of elements and do not use style names? i need to style html output produced by a server component and the output does not set styles for alternating rows. i could write a javascript (or just as well c...

CSS "properties of .x" syntax

Is it possible to add additional rules to a css block when using a "{ (properties of x) }" selector? I looked at references but I can't find anything related to "properties of x". A link would be wonderful. I tried the following two combinations, but neither worked: .dock li { (properties of grid_2; display:inline; background-color:#6...

Is there a better alternative to using css reset?

I've been trying to build a web site and I was using a CSS Reset Stylesheet to aid in cross-browser compatability. However, now that I am looking at the results in Firebug, it looks like all CSS Resets do is spend a lot of wasted time traversing up the DOM. For instance, a simple line of code like: <div><span><p>...</p></span></div> W...

Apply style to plain text inside DIV without affecting DIV's other children

Given a DIV with this general structure (class="post", from an extracted message board post) <div class="post" id="1575524"> I'm not sure why these items in the construction updates caught my eye, but they did...<br /> <br /> <div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2p...

css selector to select first class element

Hello, I'm trying to select a first element of class 'A' in an element with id or class 'B'. I've tried a combination of > + and first-child selectors, since it's not a first element inside class element 'B'. It worked, but ... i'm trying to override some default css and i have no control over the server side and it seems that the class...

How to Prevent My CSS From Clashing With Facebook's CSS?

Hi Guys, I have the following HTML on my page: <div id="mypanel"> <span>SomeText</span> <span>SomeText2</span> <span>SomeText3</span> <span>SomeText4</span> <fb:login-button ..snip.. /> </div> You can see there i have some Facebook Markup Language (FBML) for the Login button. Which get's rendered as: <span id="RES_ID...

Get CSS path from Dom element

Hi, I got this function to get a cssPath : var cssPath = function (el) { var path = []; while ( (el.nodeName.toLowerCase() != 'html') return path.join(" > "); } console.log(cssPath(document.getElementsByTagName('a')[123])); But i got something like this : html > body > div#div-id > div.site > div.clearfix > ul.choices >...