HighDots Forums  

[target]

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss [target] in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
News
 
Posts: n/a

Default [target] - 01-25-2006 , 06:27 PM






I am trying to get what I beleive is called target style to work if I use

div[title]
{
background-color:#00FF66;
}

all is fine when

<div title="mine">

but if I try

[title]
{
background-color:#00FF66;
}

I cannot get it to work on any tag, yet I have read this should work similar
to the .class selector

What am I doing wrong??



Reply With Quote
  #2  
Old   
David Dorward
 
Posts: n/a

Default Re: [target] - 01-25-2006 , 06:37 PM






News wrote:

Quote:
I am trying to get what I beleive is called target style to work if I use
div[title]
That is an attribute selector.

Quote:
all is fine when

div title="mine"

[title]

I cannot get it to work on any tag, yet I have read this should work
similar to the .class selector

What am I doing wrong??
Nothing as far as I can tell. It looks like a browser bug. Does *[title]
work?

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


Reply With Quote
  #3  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: [target] - 01-26-2006 , 02:50 AM



David Dorward wrote:

Quote:
div[title]

That is an attribute selector.
Yes, and it is of a specific kind that tests for the presence of an
attribute (explicitly in the markup, as opposite to implied attribute),
ignoring its value.

Attribute selectors are not supported by IE. This makes their usefulness
questionable on the WWW at present.

Quote:
[title]

I cannot get it to work on any tag, yet I have read this should work
similar to the .class selector
On a browser that supports attribute selectors in the first place, such
as Firefox, I have no difficulties with using [title] as a selector.

Quote:
What am I doing wrong??

Nothing as far as I can tell. It looks like a browser bug. Does *[title]
work?
I would suggest revealing the URL rather than trying variations of the
theme at random.

And don't you think it's wrong to set background color without setting
content colors (and background image to none)? Surely it was just an
example - but a bad example, and of the kind people actually use.

Besides, using a selector that tests the presence of a title attribute
sounds rather odd. There might be a reasonable reason, though, and
that's one reason why I'm curious about the URL.


Reply With Quote
  #4  
Old   
News
 
Posts: n/a

Default Re: [target] - 01-26-2006 , 01:33 PM




"Jukka K. Korpela" <jkorpela (AT) cs (DOT) tut.fi> wrote

Quote:
David Dorward wrote:

div[title] That is an attribute selector.

Yes, and it is of a specific kind that tests for the presence of an
attribute (explicitly in the markup, as opposite to implied attribute),
ignoring its value.

Attribute selectors are not supported by IE. This makes their usefulness
questionable on the WWW at present.

[title]

I cannot get it to work on any tag, yet I have read this should work
similar to the .class selector

On a browser that supports attribute selectors in the first place, such as
Firefox, I have no difficulties with using [title] as a selector.

What am I doing wrong??

Nothing as far as I can tell. It looks like a browser bug. Does *[title]
work?

I would suggest revealing the URL rather than trying variations of the
theme at random.

And don't you think it's wrong to set background color without setting
content colors (and background image to none)? Surely it was just an
example - but a bad example, and of the kind people actually use.

Besides, using a selector that tests the presence of a title attribute
sounds rather odd. There might be a reasonable reason, though, and that's
one reason why I'm curious about the URL.
I am learning CSS so I had not put it up on a URL as of yet. I just learned
that I can use
[ ] and # not just the . on the end of a tag

You are correct that it was a bad example, really it was a question. Why did
it not work?
If I create the following independant

..two{font: 2px;};//Class selector
#red{color: Red;}//ID selector
[title]{color:Green;}//Attribute selector

these work on div, p or any other tag. All except the Attribute selector
which will not work
I.E.
<p class="two"> or <div class="two"> <!--works-->
<p ID="red"> or <div ID="red"> <!--works-->
<p title="myTitle"> or <div title="yourTitle"> <!--doesn't work-->

Do you know why the Attribute selector will not work independently? I read
that it will work independently just as will the Class and ID selectors.





Reply With Quote
  #5  
Old   
David Dorward
 
Posts: n/a

Default Re: [target] - 01-26-2006 , 02:28 PM



News wrote:

Quote:
Do you know why the Attribute selector will not work independently?
I've just tested it, and it does. Thus, as I said previously, it is most
likely a browser bug.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


Reply With Quote
  #6  
Old   
News
 
Posts: n/a

Default Re: [target] - 01-26-2006 , 04:29 PM



"David Dorward" <dorward (AT) yahoo (DOT) com> wrote

Quote:
News wrote:

Do you know why the Attribute selector will not work independently?

I've just tested it, and it does. Thus, as I said previously, it is most
likely a browser bug.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/
Home is where the ~/.bashrc is
Grief that is annoying and yet good to know. Thanks, I will start checking
these things in more browsers ;-)




Reply With Quote
  #7  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: [target] - 01-27-2006 , 02:14 PM



David Dorward <dorward (AT) yahoo (DOT) com> wrote:

Quote:
Do you know why the Attribute selector will not work independently?

I've just tested it, and it does.
On some browsers, yes.

Quote:
Thus, as I said previously, it is most likely a browser bug.
I have no reason to suspect that any browser supports an attribute selector
when combined with another selector but not as standalone.

The OP probably misinterpreted the results of a test. We cannot help more
without seeing the actual test.

--
Yucca, http://www.cs.tut.fi/~jkorpela/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.