Apply Pseudo-Classes to a Div

Posted on 2011-10-02
Last Modified: 2012-05-12
I have a div called main and I cannot remember how to write the code to apply a pseudo-class for links to that "main" div
main.a:link {
	background-color: #fff;
main.a:visited {
main.a:hover {
	background-color: #666666;
main.a:active {
	color: #cc3300;
	background: #ffff99;

Open in new window

I know that is wrong but I have tried a few variations with no luck.

Thank you,
Question by:coreybryant
    LVL 16

    Accepted Solution

    . is for class,
    # is for ID,
    nothing is for html attributes.
    So if main is ID it should be like this:
    #main a:link {...
    If main is class itshould be like this:
    .main a:link {...
    LVL 29

    Author Closing Comment

    Thanks, that was it

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
    Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now