CSS ? again
- Started
- Last post
- 24 Responses
- FUZCO
If you click on a link (the colorbar) the color stays black. This is what I want, but if you click on the text, it doesn't not stay black.
I am learning about css and this is a tester.
Anyone understand what I am saying? can anyone help?
Thanks in advance.
me
- FUZCO0
:)
- gabriel_pc0
Try using some JavaScript to change the css class of the link once it's clicked. Something like:
onclick="this.className='newclas...
Let me know if this works for you.
gabe
- schjetne0
Yeah I don't think you can do that without javascript.
- FUZCO0
i think i wrote it wrong...
any links to examples that I can look at?
thanks again...
- FUZCO0
I tried javascript and it leaves it there forever, i just wanted it selected when it is selected.
I take it is not possible?
- DigitalMe0
You need to look into Psuedo Class references from your anchor tags.
Here's what the class definition will look like
.default {font-family: Verdana;}
...then your psuedo class def will follow like this...
a.default:link
{font-family: Verdana;}a.default:visited
{font-family: Verdana;}a.default:hover
{font-family: Verdana;}a.default:active
{font-family: Verdana;}...................
I usually condense the link and visited to the same def. and then the hover and active to the same def. like this...a.default:hover, a.default:active {font-family: Verdana;}
In the HTML, the class is referenced from a TD, SPAN or DIV, as usual, then your psuedo class reference is made from you A tag like this
<TD class="default"> <A HREF="blah" CLASS="default">
hope this helps
- sparker0
i think the problem you're experiencing is related to IE. if i click on a box in firebird it stays black until i click on a different menu item.
this goes for both text and the box element.
so i think it works the way you want it to.
but, your css document is a little funky.
one of the best things you can do is to asign a "display: block;" to each a element. then change the background color depending on which state the a element is in.
you will need to define rules for all the states - active, hover, visited, and the normal 'a'.
also, this is a good time to adapt using lists for menus like this.
read this: http://www.alistapart.com/storie…
it will help you set up a basic menu with mouse-over effects in css and valid xhtml.
also, and this is personal opinion, but i wouldn't rely on frames for any site.
hope this helps.
- FUZCO0
Is the code really bad on my part...
look again, I have added the css to view...
- jox0
wtf, that site automatically opens my Dreamweaver showing the css as code! never seen that before in my entire life
- FUZCO0
ooppss...
sorry. Don't know why that happened?
Maybe, because I did a direct link to it.
- jox0
um. yeah, you have it framed.
- jox0
use the link rel tag on the page using the stylesheet. No need to give the code a frame of it's own.
- FUZCO0
It is not going to be a page of its own, I was just trying to learn how to create a better css page.
I posted in a frame so others could view it and tell me what I am doing wrong. (the selection problem)
- jox0
oh, sorry, my bad. I should've paid more attention to what you said.
Embarrassing.
*sound of feet pattering away
- sparker0
hm. that's not the css doc i saw when i inspected your code with firebird's 'web developer' extension the first time....hmmm...weird.
anyway. no, it's not bad.
:)
- FUZCO0
your right, i added the focus as a test.
- FUZCO0
another small problem.
What did I do wrong, that opera doens't like me...
- DigitalMe0
On my machine you're opening visualstudio dot net. The reason is the way you've commented the first line of the style sheet. You should HTML commenting here like this:
<!-- MY COMMENT -->
- DigitalMe0
actually scratch that. it's a matter of file associations on the client end. I see now you're linking directly to the file *.css
sorry