| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi. i am using the a:link, a: hover, etc. convention in my style sheet. I call the code using:
Code:
Writer.RenderBeginTag(HtmlTextWriterTag.A) i have another area of my page where i want to use the behaviours of a:etc but i want to change some of the layout stuff such as font and color. so, i created another area called b:link, b:hover, and so on. in these areas of my page, i call: Code:
Writer.RenderBeginTag(HtmlTextWriterTag.B) my problem is that, no matter what i seem to do, "B" doesn't seem to do anything. It goes to the web pages master layout and doesn't link, hover, or anything. i have tried commenting out all of the other CSS references except "B" and it still doesn't matter... Are "link, hover, active, etc" only reserved for "A"? That seems silly to me. What am i doing wrong? Help much appreciated at this point... |
|
#2
|
|||
|
|||
|
Throw this in the style sheet
.linkfont { color: green; font-family: verdana , sans-serif; font-size:11px; } a.linkfont:hover { color: #808080; text-decoration: underline; } .linkfont2 {color: blue; font-weight: bold; font-family: verdana , sans-serif; font-size:11px; } a.linkfont2:hover { color: #FF0000; text-decoration: underline; } and use this for your links <a href="somepage.asp" class="linkfont">Link 1</a> <a href="somepage2.asp" class="linkfont2">Link 2</a> Hope this helps |
|
#3
|
|||
|
|||
|
Hi. Thanks for your reply. That is more or less what i am doing except i am generating my code programatically so the code:
Code:
<a href="somepage.asp" class="linkfont">Link 1</a> <a href="somepage2.asp" class="linkfont2">Link 2</a> actually looks like this: Code:
Writer.RenderBeginTag(HtmlTextWriterTag.Td)
Writer.AddAttribute(HtmlTextWriterAttribute.Href, "mypage.aspx")
Writer.RenderBeginTag(HtmlTextWriterTag.A)
Writer.WriteLine("this is my link text")
Writer.RenderEndTag()
Writer.RenderEndTag()
In my style sheet, i have "A:link, A:active, A:hover, etc" which all describe the look and format of "certain links" on mypage.aspx. then, for other links on the same page, "mypage.aspx", i have included "B:link, B:active, B:hover, etc" to acheive a different formatting look and feel. The problem is that B:etc does absolutely nothing despite my best efforts. For clarification, I have posted this area of my style sheet below" Code:
A:link
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 1em;
font-weight: normal;
font-style: normal;
text-decoration: none;
word-spacing: normal;
letter-spacing: normal;
text-transform: none;
text-decoration: none;
BACKGROUND: none;
color: #3333cc;
}
A:visited
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 1em;
font-weight: normal;
font-style: normal;
text-decoration: none;
word-spacing: normal;
letter-spacing: normal;
text-transform: none;
text-decoration: none;
BACKGROUND: none;
color: #333399;
}
A:active
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 1em;
font-weight: normal;
font-style: normal;
text-decoration: none;
word-spacing: normal;
letter-spacing: normal;
text-transform: none;
text-decoration: none;
BACKGROUND: none;
color: #333399;
}
A:hover
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 1em;
font-weight: normal;
font-style: normal;
text-decoration: none;
word-spacing: normal;
letter-spacing: normal;
text-transform: none;
text-decoration: underline;
BACKGROUND: none;
color: #FF0000;
}
B:link
{
/*font-family: Verdana, Arial, Helvetica, sans-serif;*/
font-size: 1em;
font-weight: normal;
font-style: normal;
text-decoration: none;
word-spacing: normal;
letter-spacing: normal;
text-transform: none;
text-decoration: none;
BACKGROUND: none;
color: #3399CC;
}
B:visited
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 1em;
font-weight: normal;
font-style: normal;
text-decoration: none;
word-spacing: normal;
letter-spacing: normal;
text-transform: none;
text-decoration: none;
BACKGROUND: none;
color: #333399;
}
B:active
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 1em;
font-weight: bold;
font-style: normal;
text-decoration: none;
word-spacing: normal;
letter-spacing: normal;
text-transform: none;
text-decoration: none;
BACKGROUND: none;
color: #FFFFFF;
}
B:hover
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 1em;
font-weight: normal;
font-style: normal;
text-decoration: none;
word-spacing: normal;
letter-spacing: normal;
text-transform: none;
text-decoration: underline;
BACKGROUND: none;
color: #FF0000;
}
I reference the "B" code the same way i referenced the working "A" code: Code:
Writer.RenderBeginTag(HtmlTextWriterTag.Td)
Writer.AddAttribute(HtmlTextWriterAttribute.Href, "mypage.aspx")
Writer.RenderBeginTag(HtmlTextWriterTag.B)
Writer.WriteLine("this is my link text")
Writer.RenderEndTag()
Writer.RenderEndTag()
Can anybody tell me why the "A:hover, A:link, etc" code works while the "B:hover, B:link, etc" code has no effect? This one has me stumped... |
|
#4
|
||||
|
||||
|
There is no "b" element in XHTML. Only the <a> element which is short for "<a>nchor".
Please learn the intracies of XHTML and SGML before dwelving into server-side programming ![]() If you want to specify a different "style" of anchor elements, just give them a different classname (note: NOT to be confused with an OOP class) and then style it from CSS. And question: Why is your CSS full of useless properties? And why do you have "text-decoration: none;" several times for the same style rule? Oh, and I'm an ASP.NET dev too... and I never use the HtmlWriter.... mainly because its too reliant on the BrowserCaps table (thus, you get convulted output when you're not using IE... plus it is rather slow). What's wrong with appending the elements manually using a StringBuilder? |
|
#5
|
||||
|
||||
|
the <b> tag is valid in old html afaik, but it's not link it's used to make bold text.
and hover effect for any element is not supported by IE (only for <a> tag), that's probably why "it's not working" for you in case you're using IE to test your pages... |
![]() |
| Viewing: ASP Free Forums > Web Design > Web Layout > altering A:link, etc... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|