Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / January 2006



Tip: Looking for answers? Try searching our database.

[target]

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
News - 26 Jan 2006 00:27 GMT
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??
David Dorward - 26 Jan 2006 00:37 GMT
> I am trying to get what I beleive is called target style to work if I use
> div[title]

That is an attribute selector.

> 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?

Signature

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

Jukka K. Korpela - 26 Jan 2006 08:50 GMT
>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.
News - 26 Jan 2006 19:33 GMT
>>div[title] That is an attribute selector.
>
[quoted text clipped - 28 lines]
> 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.
David Dorward - 26 Jan 2006 20:28 GMT
> 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.

Signature

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

News - 26 Jan 2006 22:29 GMT
>> 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.

Grief that is annoying and yet good to know. Thanks, I will start checking
these things in more browsers ;-)
Jukka K. Korpela - 27 Jan 2006 20:14 GMT
>> Do you know why the Attribute selector will not work independently?
>
> I've just tested it, and it does.

On some browsers, yes.

> 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.

Signature

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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.