By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

Redifine <a> tag.

P: n/a
Hello,

I difined the <atag on my web site as follows:
a, a:link, a:visited
{
color: #194B00;
text-decoration: underline;
}

Now I need to redifine the <atag when it appears inside the DIV with
ID="pWebSite" or inside any "pWebSite" child tag.

What happens is that the <atags inside DIV "pWebSite" keep having the
same look as the default

My CSS code for this is:
a.pWebSite, a.pWebSite:link, a.pWebSite:visited
{
color: #000000;
text-decoration: none;
}

And my HTML code is:

<div id="ctl00_pWebSite" class="pWebSite" style="width: 600px;
text-align: left;">
<table id="ctl00_casmSiteMap" border="0">
<tbody>
<tr>
<td>
<div>
<a href="#"</a>
</div>
<div style="display: inline;">
<a href="/JaquelineRoxoAtelier%202006a/default.aspx">
Página Inicial </a>
</div>
&nbsp;|&nbsp;
<div style="display: inline;">
<a href="/JaquelineRoxoAtelier%202006a/contacts.aspx">
Contactos </a>
</div>
<br>
<br>
</td>
</tr>
</tbody>
</table>
</div>

Thanks,
Miguel

Sep 21 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Els
shapper wrote:
I difined the <atag on my web site as follows:
a, a:link, a:visited
{
color: #194B00;
text-decoration: underline;
}

Now I need to redifine the <atag when it appears inside the DIV with
ID="pWebSite" or inside any "pWebSite" child tag.
An ID can only appear once per page. Use class if it appears more than
once.
What happens is that the <atags inside DIV "pWebSite" keep having the
same look as the default

My CSS code for this is:
a.pWebSite, a.pWebSite:link, a.pWebSite:visited
That is because you didn't give that id to the <a>, but to the div.
<div id="pWebSite"><a href="...">link</a></div>

To address that <ainside that div, change the CSS to:

div#pWebSite a,
div#pWebSite a:link,
div#pWebSite a:visited{.. rules ..}

Also, please note, that div.pWebSite addresses divs with
class="pWebSite", while div#pWebSite addresses divs with
id="pWebSite".

Here is a link you may find useful to determine which rule applies to
which element:
http://gallery.theopalgroup.com/selectoracle/

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/

Now playing: Henk Westbroek - Zelfs je naam is mooi
Sep 21 '06 #2

P: n/a
Hello,

I made it work as you said but I have a problem. I am using Asp.Net 2.0
which redifines ID's when using master pages.

As you can see in the code I posted the ID "pWebSite" becomes
"ctl00_pWebSite".
This is a problem because I don't know the client side ID's. Only the
server side Id's.

So in relation to CSS is that a way to make redifine the <atag under
the div "pWebSite" but refering to its class and not to its ID?

Thanks,
Miguel
Els wrote:
shapper wrote:
I difined the <atag on my web site as follows:
a, a:link, a:visited
{
color: #194B00;
text-decoration: underline;
}

Now I need to redifine the <atag when it appears inside the DIV with
ID="pWebSite" or inside any "pWebSite" child tag.

An ID can only appear once per page. Use class if it appears more than
once.
What happens is that the <atags inside DIV "pWebSite" keep having the
same look as the default

My CSS code for this is:
a.pWebSite, a.pWebSite:link, a.pWebSite:visited

That is because you didn't give that id to the <a>, but to the div.
<div id="pWebSite"><a href="...">link</a></div>

To address that <ainside that div, change the CSS to:

div#pWebSite a,
div#pWebSite a:link,
div#pWebSite a:visited{.. rules ..}

Also, please note, that div.pWebSite addresses divs with
class="pWebSite", while div#pWebSite addresses divs with
id="pWebSite".

Here is a link you may find useful to determine which rule applies to
which element:
http://gallery.theopalgroup.com/selectoracle/

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/

Now playing: Henk Westbroek - Zelfs je naam is mooi
Sep 21 '06 #3

P: n/a
shapper wrote:
I made it work as you said but I have a problem. I am using Asp.Net 2.0
which redifines ID's when using master pages.
Use class instead of id

Sep 21 '06 #4

P: n/a
shapper wrote:
I difined the <atag on my web site as follows:
a, a:link, a:visited
{
color: #194B00;
text-decoration: underline;
}
Visited links should not have the same color as unvisited links, else
how will your visitors know where they have already been?

--
-bts
-Motorcycles defy gravity; cars just suck.
Sep 21 '06 #5

P: n/a
I know, that was just an example I wrote here.

Beauregard T. Shagnasty wrote:
shapper wrote:
I difined the <atag on my web site as follows:
a, a:link, a:visited
{
color: #194B00;
text-decoration: underline;
}

Visited links should not have the same color as unvisited links, else
how will your visitors know where they have already been?

--
-bts
-Motorcycles defy gravity; cars just suck.
Sep 21 '06 #6

P: n/a
Andy,

I can set the CSSClass of the Asp.Net control to "MyClass" in my CSS
file.
When the HTML code is generated by Asp.Net Framework MyClass is added
as Class to a Div. The <atags inside that div, which are also
generated by the control, or the <atags inside child tags of that
<divis what I need to change.

Do you understant?

So how, using CSS, can I change the style of all <atags under <div
class="MyClass">?

This is the main problem.

Thanks,
Miguel
Andy Dingley wrote:
shapper wrote:
I made it work as you said but I have a problem. I am using Asp.Net 2.0
which redifines ID's when using master pages.

Use class instead of id
Sep 21 '06 #7

P: n/a

shapper wrote:
I can set the CSSClass of the Asp.Net control to "MyClass" in my CSS
file.
If you don't have full control of the class attributes in your
framework, then discard the framework. It's not much to ask is it? If
it won't even let you do this much, what use is it?

Sep 21 '06 #8

P: n/a
..MyClass a{blah:blah;}
Andy,

I can set the CSSClass of the Asp.Net control to "MyClass" in my CSS
file.
When the HTML code is generated by Asp.Net Framework MyClass is added
as Class to a Div. The <atags inside that div, which are also
generated by the control, or the <atags inside child tags of that
<divis what I need to change.

Do you understant?

So how, using CSS, can I change the style of all <atags under <div
class="MyClass">?

This is the main problem.

Thanks,
Miguel
Sep 22 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.