0

Is there a way to make that normal text and links share the same style in CSS ?

Please find below an example :

div.test, div.test a
{
font-size:0.8em;
}

I would like text and links to get the same style but it is not working as expected...

Any help welcome.

Cheers.

Gotye.

2
  • Well, what does it do? Commented Jan 7, 2011 at 2:23
  • Is the a tag nested within the div with class test? Have you tried changing the font-size value to ensure that it works? Commented Jan 7, 2011 at 2:24

1 Answer 1

5

Just specify

div.test
{
    font-size: 0.8em;
}

Otherwise you are telling links inside div.test to have 80% font size of div.test, which in turn is 80% of whatever its parent is. That's 64% the font size of div.test's parent, so it appears smaller.

If you're trying to give normal text and link text the same color, or other properties that don't depend on relative sizing, use div.test, div.test a as you're doing but place it in a separate rule. For example:

div.test
{
    font-size: 0.8em;
}

div.test, div.test a
{
    color: #330;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.