css-selectors

PHP CSS Selector Library?

Is there a PHP class/library that would allow me to query an XHTML document with CSS selectors? I need to scrape some pages for data that is very easily accessible if I could somehow use CSS selectors (jQuery has spoiled me!). Any ideas? ...

css: Should I limit the use of universal selectors (*.classname vs a.classname)?

I have a question about css selectors. Say I have the following html <div class="message"> <div class="messageheader"> <div class='name'>A news story</div> </div> </div> In the css I could refer to the class called name either like this div.message div.messageheader div.name {} or .name {} /* ie *.name{} */ Is one way ...

What is the replacement for the child selector ?

Since IE6 does not support the child selector (see http://kimblim.dk/csstest/#ex1), what is the alternative when dealing with this browser? I do not want to modify the markup, and I'd much much prefer a CSS-only solution... And yes, it is the direct child that I wish to target. Thanks! ...

jQuery: exclude $(this) from selector.

Hi. I have something like this: <div class="content"> <a href="#">A</a> </div> <div class="content"> <a href="#">B</a> </div> <div class="content"> <a href="#">C</a> </div> When one of these links is clicked, I want to perform the .hide() function on the links that are not clicked. I understand jQuery has the :not selecto...

CSS Selector for <input type="?"...

Is there any way with CSS to target all inputs based on their type? I have a disabled class I use on various disabled form elements, and I'm setting the background color for text boxes, but I don't want my checkboxes to get that color. I know I can do this with seperate classes but I'd rather use CSS if possible. I'm sure, I can set th...

CSS Selector for selecting an element that comes BEFORE another element?

I'm working on a login page for my website and I want to bold the label that comes before the input box when the text box gains focus. Right now I have the following markup: <label for="username">Username:</label> <input type="textbox" id="username" /> <label for="password">Password:</label> <input type="textbox" id="password" /> I c...

Understanding CSS selectors

Why is it that the below makes the text red? #stories li a {color:red} .default li.expand a {color:green} li.expand a {color:blue} <ul id="stories" class="default"> <li>this is the end</li> <li class="expand">this is the end</li> Only if I put #stories on the others will the text change. Does a # have more dominance even tho...

How to style <input type="text"> in IE6 CSS?

Is there any elegant way of applying a certain style to all <input type="text"> elements under IE6? I can do it with some JavaScript, but I was wondering if there was a more elegant way of doing it. Note - I cannot apply a certain class to all textboxes by hand. And I'd like to avoid CSS expressions. ...

Tools to make CSS sprites?

Are there any good tools to make css sprites? IDEALLY I'd want to give it a directory of images and an existing .css file that refers to those images and have it create a big image optimized with all the little images AND change my .css file to refer to those images. At the least I'd want it to take a directory of images and generate ...

Why is my CSS having specificity problems?

Can someone explain me why in this example the first rule is taken not second? According to my CSS specificity knowledge, the second is more specific and should be used. But all browsers use first. Example: http://apblog.lv/misc/css_spec/example2.html CSS: table.data .negative { /* css specificity: 0,0,2,1 */ color: red; } ta...

jQuery: CSS Selectors

How would I use jQuery CSS Selectors to find for instance: css class name: "Text" which is a div inside of dom object "wrapper"? ...

Getting 'Last Child' of Div ?

Is there another way to get the last child of a div element other than using p:last-child which does not work in IE at least? ...

What are good 'marker' css styles to define?

I am finding it useful to define 'marker' css styles such as 'hidden' or 'selected' so I can easily mark something as hidden or selected - especially when using a tag based technology like ASP.NET MVC or PHP. .hidden { display:none; } .newsItemList li.selected { background-color: yellow; } I don't especially feel like reinven...

What's better in CSS: div.something or just .something

In CSS, when setting a style on a div (for example) is there any benefit in including the 'div' other than to give it more precision for matching. Is it faster for the browser to render perhaps? ie Is: div.something { font-size: 1em; } better than .something { font-size: 1em; } for any other reason than to narrow it down to only d...

jQuery: How to match first child of an element only if it's not preceeded by a text node?

I'm trying to match the h4 of a div (using jQuery) so that I can remove it's top margin. However, I only want to match the h4 if it has no text on top of it. For example, match this: <div> <h4>Header</h4> ... </div> but not this: <div> Blah blah blah. <h4>Header</h4> ... </div> The best code I could come up with in jQue...

E#myid vs. #myid CSS Selectors

I'm curious what the difference is b/w E#myid vs. #myid (E is any element) given that there can only be one element with #myid on a page? ...

remove unused css selectors other than 'Dust Me Selectors'?

I would like to remove all unused css selectors from a common css file. While the Firefox extension "Dust Me Selectors" works well, it only works per page. It reports unused selectors for a page but some could be used on other pages. Is there a tool which can go through a folder, scan all the files and bring up a list of selectors which...

ASP.NET menus and CSS?

Hi I have the feeling that using Sitemap in ASP.NET is not conducive to CSS. Where do I format a menu to look like CSS can make it look. Where are mu ul and li's? ...Beginner, so forgive me if there right under my nose. ...

Which CSS selector should set background-image property?

In order to have an overall background image for a whole page, should I set the background image for the html, body, or both? ...

How to get all options of a select using Jquery?

How can I get all the options of a select through Jquery by passing on its ID? Edit: Only looking to get their values, not the text ...