css-selectors

jQuery click event still firing on filtered element

I'm trying to filter button events based on whether they have a CSS class assigned to them or not. Assume I have a button like this: <button id="save-button" class="ui-state-default ui-corner-all">Save</button> I want to get jQuery to select all buttons that currently do not have a class of "ui-state-disabled". The selector I'm usin...

How to show html template using inline styles only?

Hi, I want to display html template in a webpage. The styles of that template is specified inline. But when i try to display it in my webpage, some styles that are defined in my css are adding into it and the template is not displayed properly. This template is used to create mails and when i send this template as mail to my gmail accoun...

In jQuery does the advanced CSS3 selection style work in all browsers?

I'm watching a tutorial learning JQuery for the first time, and it seems you can select items using pretty much CSS, like: $('ul li:nth-child(3)').addClass('biscuits'); Is that kind of selector going to work on all browsers, or just ones that support CSS 3 ? ...

jQuery sum events on TD click

I have a simple table to simulate a Gantt chart. The idea is that each TD clicking trigger a sum of values stored in an hidden input text (an array of values), available in a TH (first son of TR tag). The row sum of these values, is shown on a final TD. Next, the code table: <table width="100%" cellspacing="0" class="datagrid_ppal"> ...

How to reinforce pseudo css rules

Is there anyway to reinforce pseudo css rules? ie: I have a listing of divs (playlist) which I color with the following rules: #playlist .playlist_item { background: #d6d6d6; } #playlist .playlist_item:nth-child(odd) { background: #b3b3b3; } Now, when a song is playing, I use setInterval and JQuery's .animate function to pulse...

Nested <a> and <span> challenge

Hi all, Trying in vain to get a nested link working within a nested span. This is a working test page for the code below to explain what I'm trying to do. Any ideas on how to get this working in valid html? I guess it's either a nesting order or style syntax thing but I am at a loss. Any thoughts much appreciated. <div id="greyback">...

Best practice: How to use (repeat) CSS style attributes correctly?

Hi guys! As a CSS newbie I'm wondering if it's recommended by professionals to repeat specific style attributes and their not inherited but default properties for every relevant selector? For example, should I rather use body {background:transparent none no-repeat; border:0 none transparent; margin:0; padding:0;} img {background:transpa...

CSS Select only List after 1st layer

Given <ul class="menu"> <li> <!-- layer1 --> <a href="/gbcweb/index.php?option=com_content&amp;view=article&amp;id=19&amp;Itemid=27"> <span>sub menu</span> </a> <ul> <li><!-- layer2 --> <a href="/gbcweb/index.php?option=com_content&amp;view=article&amp;id=22&amp;Itemid=34"> <span>s...

is there any way to group css styles based on their ids?

If I have a chunk of css styles that are applied within a certain page element, I would like to group them rather than identify the containing page element for each style. For example, I would like to turn: #bodywrap #leftcolumn p {...} #bodywrap #leftcolumn div {...} #bodywrap #leftcolumn .highlight {...} into something like: #bodyw...

What is the performance impact of CSS's universal selector?

I'm trying to find some simple client-side performance tweaks in a page that receives millions of monthly pageviews. One concern that I have is the use of the CSS universal selector (*). As an example, consider a very simple HTML document like the following: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ...

Flex 4 - CSS type selectors in MXML components

Does anybody know the reason why CSS type selectors cannot be used inside MXML components, and/or a trick to make it work? I see absolutely no reason for a such simple functionnality not to be supported, and I'd really like to understand. After all I read about CSS in Flex 4 being so much better than in Flex 3, I find myself quite disa...

CSS problem in IE7 and IE8

i have problem in IE7 and IE8 i have used ordered list with css for its li.It is ok in other browse. The problem is that list starts with 1 and then jumps to 3 and then 5 and respectively. how should i handle this...?? ...

jQuery: exclude some elements by classes and select the rest

I use the following code to select all external links on the page items = jQuery("a[href^=\'http:\']").not("[href*=\'" + window.location.host + "\']"); But I need to exclude links from tags with some known classes, e.g. I want to exclude "class1" and "class4" and select whatever have left. <body> <div> <p class="class1"> <span ...

Using sass, how do you style "#div1 img, #div2 img { height: 80px }" ?

Using sass, how do you style #box1 img, #anotherbox img { height: 80px } ? Is using mixins the only way? ...

Jquery selectors by CSS class in IE is really slow--workarounds?

I have a web app where I have several elements with class="classA". I want to select and apply a function to all of them. I am doing the obvious thing, which is $(".classA").each(function () { ... }). This works just fine in Chrome/Safari/Firefox but is really slow in IE. It turns out IE has serious performance issues when selecting thin...

Aligning data in a table

In the following table, how do I align the data in td cells such that we do not get a horizontal scroll bar, using CSS? Also the requirement is that the height of the table should be adjusted automatically.. <table> <tr><th>name</th> <th>info</th></tr> <tr><td>Harry</td> <td>suminfosuminfosuminfosuminfosum infosuminfosum...

How do i select the 1st and then every 4th row in a html-table with nth-child()-selector?

Ok, math isn't my strong side, I admit it. All I want to do is to select the first, 5th, 9th, 13th, 17th etc row in a html-table. Can anybody with better math-skills point me in the right directionor perhaps supply a "nth-child-for-dummies" guide? I tried nth-child(1n+4) (which selects the 4th row and everyone after), and i also tried...

In CSS, is ".class1.class2" legal and common usage?

I am quite used to seeing div.class1 and #someId.class1 but what about .class1.class2 ? And I think it is identical to .class2.class1 ? Because there was an element with id someId but now we have two elements of this type showing on the page, so I want to add a class and use the class instead of id, therefore the .class1.cl...

How to select an html element according to its child node attribute in css?

For example, in the following snippet: <tr> <td align="center">123</td> <td class="someclass">abc</td> </tr> I would like select all <tr> elements that have a <td> with the class="someclass". I am wondering if this is possible in css, without using javascript. Thanks. ...

CSS: give the same width to the text and password inputs

Hi, i'm trying to give the same width to the text and password inputs. So i write this: input[type="text","password"]{ width: 138px; } But it doesn't work. Any help? Regards Javi ...