css-selectors

Is this a bug in how jQuery treats child selectors?

Is there a bug in how jQuery handles child selectors or am I missing out on something obvious? I can't get it to work when the child is anything other than *. Here's the jQuery selector I am running: $("#myTable > tr").each(function() { // do somthing } ); And the table structure is: <table id="myTable"> <tr> <td><bu...

:hover pseudo-class of CSS does not work in IE7

Hi guys I have problem with the :hover pseudo-class of CSS. I am using it like tr.lightRow:hover { color:red } It works in Safari and Firefox but it does not work in IE7. Please help me. ...

:nth-of-type() in jQuery / Sizzle?

It surprised me that Sizzle (the selector engine jQuery uses) comes with a built-in :nth-child() selector, but lacks an :nth-of-type() selector. To illustrate the difference between :nth-child() and :nth-of-type() and to illustrate the problem, consider the following HTML document: <!doctype html> <html> <head> <meta charset="utf-8"...

css selector for first direct child only

I have the following html <div class="section"> <div>header</div> <div> contents <div>sub contents 1</div> <div>sub contents 2</div> </div> </div> And the following style DIV.section DIV:first-child { ... } For some reason that I don't understand the style is getting applied to ...

dojo.query not working for attribute selector that includes a tilda (~) character

I need to select a link node given its url. Using an attribute selector works quite well except for a few rare cases when the url has a tilda. I have no control over the link urls. Here is an example: <script> dojo.ready(function() { var node = dojo.query('a[href="http://abc.com/~123"]')[0]; console.debug(node); ...

jQuery CSS selector question

Whats wrong with this CSS selector i'm using in jQuery? Trying to select all tr's within a table of ID "itable" without a class of "mod" where its possible for multiple classes to be on each tr. if($('#itable tr:not[class~=mod]').length == 0){ //something } ...

Correcting webkit text stroke in Sass

I'm using Sass to generate my CSS stylesheets. I want consistent typography, so I want to use the CSS rules from http://orderedlist.com/our-writing/resources/html-css/thinning-text-in-webkit-safari/ to thin the text in Webkit-based browsers. I thought this would do the trick: body -webkit-text-stroke: 1px transparent @media only scree...

How to write this css in shorter way? see example

If this a situation. p{margin-bottom:5px} #top-textContainer p {margin-bottom:10px} Is there a way to write this in a shorter way , or no other option #board-committees #top-textContainer p, #corporate-governance #top-textContainer p, #corporate #top-textContainer p, #about-us #top-textContainer p, #contact us #top-textContainer p{m...

Combining two or more CSS selectors with a boolean condition

Is there a way to combine two or more CSS selectors using a boolean condition - and, or, not? Consider this <div>: <div class="message error"> You have being logged out due too much activity. </div> Could I select only those elements that contain both the classes for instance? Something along the lines of div.message && div.erro...

CSS Attribute selector - Match attribute values that begin with

I am trying to identify all the <UL> that contain a menu list by defining the ID like this: <ul id="menutop"> <li><a href="#">item1</a></li> <li><a href="#">item2</a></li> <li><a href="#">item3</a></li> </ul> <ul id="menumain"> <li><a href="#">item1</a></li> <li><a href="#">item2</a></li> <li><a href="#">item3</a...

Best way to GET the xpath and css selector of a specific element

Looking for the best way to GET the xpath and css selector of a specific element using jQuery or Extjs. To basically select a random element and traverse up the dom and retreive it's unique css selector or xpath. Is there a function that can do this already or does anyone have a custom function that can do this? ...

Changing Input Background Color on Google Custom Search

Although this seems like a simple task, I need to change the background color of an GOogle Custom Search input field. You can view the page here Currently, the input field is white, and I need to change it to #4e4e4e. The problem is that I cannot seem to find the correct CSS selector to set the background color. It looks like the google...

Is it possible to select an an element that immediately preceeds aother element using the adjacent selector

I would like to select <label> elements that immediately preceed <input type="checkbox"> from the CSS guide Adjacent sibling selectors have the following syntax: E1 + E2, where E2 is the subject of the selector. But, unless I'm misunderstanding the spec I need a select where E1 is the subject not E2. I'm sure this must be av...

What does "body > *" mean in CSS?

I am trying to understand the CSS effects that jQTouch implements. http://www.jqtouch.com/ It has some CSS definitions that contain syntax like "body > *" body > * { -webkit-backface-visibility: hidden; -webkit-box-sizing: border-box; display: none; position: absolute; left: 0; width: 100%; -webkit-transform...

Multiple classes in body tag, multi-dimensional css structure or blueprint for insanity?

This question is about an approach to css structuring, and so is more discussion oriented. I'm working with some outsourced css where the body tags have multiple classes assigned, up to half a dozen. (To make things a little worse, none of the css selectors include an html tag which is making it confusing to analyze the css.) These body...

Is there an addon which you can test css selectors in firefox?

I was wondering if there is such an addon in firefox where you can test out css paths to check if they are finding the correct element? I was looking for something similar to xpather for xpath locations. ...

Affecting parent element of :focus'd element (pure CSS+HTML preferred)

How can I change the background of a parent <div> when an <input> or <a> is :focus'd (or any other dynamic pseudo-class? Eg <div id="formspace"> <form> <label for="question"> How do I select #formspace for the case when a child is active?</label> <input type="text" id="question" name="answer"/></form></div> ...

Asp.Net-MVC: How to style <%=Html.ActionLink()%> with Css?

Hello, Here's a piece of my HTML code <div id = "mydiv"> <% = Html.ActionLink("Some Text","SomeAction")%> </div> I'd like to style it in white so that it doesn't conflict with the background, which is also blue. So I did this: #mydiv {background-color:blue;} #mydiv a:link { color:white} But, it doesn't work -- the color it's ...

Why won't "!important" override ":first-line"?

I am trying to do the tutorial in Chapter 6 of the 2nd edition of "CSS: The Missing Manual", and I've run into an issue I'm trying to understand. I have one style that looks like this: #main p:first-line { color: #999999; font-weight: bold; } Later I have another style that looks like this: #main p.byline { color: #00994...

access html content through CSS ?

<div id=menu> <ul> <li class="section-title">auto-text1</li> <li class="section-title">auto-text2</li> <li class="section-title">auto-text3</li> </ul> </div> How can I give special treatment to auto-text3 through css? ...