Re: [WSG] Parent Selectors
At 02:08 PM 3/3/2005, RMW Web Publishing wrote: If I did that then the border [on the 'a'] appears a few pixels below the bottom of the image (looks wrong). To get it directly under the image I'd have to add margin-bottom: 0; to the 'a' which defeats the purpose of removing the underline. - Original Message - From: Paul Novitski [EMAIL PROTECTED] | But in this case, I don't think you have to. If an image is the only thing | inside a hyperlink, why not simply remove your border from any image whose | parent is an anchor? In a very quick test in Firefox IE, applying {display: block;} to the linked image seems to work, but you'd have to play with it to see if this is some kind of fluke: a { text-decoration: none; border-bottom: thin solid #F00; } a img { display: block; border: thin solid #000; } pa href=#Text link/a/p pa href=#img src=test.jpg alt= //a/p Paul ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] Parent Selectors
how about a img { ... } though i'd rather see #nav a img { ... } See for more info --- http://www.westciv.com/style_master/academy/css_tutorial/selectors/descendant_selectors.html Cheers Chris RMW Web Publishing wrote: I trying do solve a selector (see http://css.maxdesign.com.au/selectutorial/selectors_type.htm) that I'm not sure can even be solved (without changes to my HTML) I am using a bottom border on links for easier reading (compared with underlines), but only want the border to appear on text links - not images. Is there a why to set the style on a parent ('a') when you know what the child is ('img')? HTML: img src=icon.png title=Image alone style=width:20px;height:20px / a href=nowhere.html title=Link aloneLone link/a a href=somewhere.html title=Link imageimg src=icon.png title=Image alone style=width:20px;height:20px //a CSS: a { text-decoration: none; border-bottom: thin solid black; /* easier to read as does not cut through g's, y's, etc */ } img { margin: 0; border: thin solid black; } PS. Mac OSX users coding in Dreamweaver might want to try http://www.skti.org/. I started using t last week and have not looked back. ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] Parent Selectors
Um.. Sorry I see what you are trying to do now.. I read that a bit too fast the first time ... Good question! Chris Blown wrote: how about a img { ... } though i'd rather see #nav a img { ... } See for more info --- http://www.westciv.com/style_master/academy/css_tutorial/selectors/descendant_selectors.html Cheers Chris RMW Web Publishing wrote: I trying do solve a selector (see http://css.maxdesign.com.au/selectutorial/selectors_type.htm) that I'm not sure can even be solved (without changes to my HTML) I am using a bottom border on links for easier reading (compared with underlines), but only want the border to appear on text links - not images. Is there a why to set the style on a parent ('a') when you know what the child is ('img')? HTML: img src=icon.png title=Image alone style=width:20px;height:20px / a href=nowhere.html title=Link aloneLone link/a a href=somewhere.html title=Link imageimg src=icon.png title=Image alone style=width:20px;height:20px //a CSS: a { text-decoration: none; border-bottom: thin solid black; /* easier to read as does not cut through g's, y's, etc */ } img { margin: 0; border: thin solid black; } PS. Mac OSX users coding in Dreamweaver might want to try http://www.skti.org/. I started using t last week and have not looked back. ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] Parent Selectors
At 09:34 PM 3/2/2005, RMW Web Publishing wrote: I am using a bottom border on links for easier reading (compared with underlines), but only want the border to appear on text links - not images. Is there a why to set the style on a parent ('a') when you know what the child is ('img')? I believe the direct answer is no -- you can't style a parent based on the type of child it has. See W3C CSS 2.1 specification 5 Selectors 5.1 Pattern matching http://www.w3.org/TR/CSS21/selector.html#q1 But in this case, I don't think you have to. If an image is the only thing inside a hyperlink, why not simply remove your border from any image whose parent is an anchor? a { text-decoration: none; border-bottom: thin solid #000; } a img { border-bottom: none; } Paul ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] Parent Selectors
RMW Web Publishing wrote: Is there a why to set the style on a parent ('a') when you know what the child is ('img')? No. And this is why CSS selectors suck and the W3C should have used XPath (maybe with some syntactic sugar so you didn't need to type descendant-or-self all the time to get all child nodes). .Matthew Cruickshank http://holloway.co.nz/ ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **