1

Very new to web design, sorry for the obvious Q, but I am breaking my head here.

I can't understanding why can I not get the text color from my CSS file..

I tried:

<p style = "color:red">bla1</p>

<div class ="colorRed">bla2</div>

bla1 is red, but bla2 isn't.

My .css:

.colorRed
{
    color : red;
}
2
  • have you linked your css file between <head> Commented May 10, 2014 at 7:08
  • :] as i said, very new to this, thx Commented May 10, 2014 at 7:10

2 Answers 2

3

Your css code is correct. Check that you have linked css file in your html code or not.

<link rel="stylesheet" type="text/css" href="style.css"/>

or put your css directly into style tag as follow

<html>
<head>
<style>
.colorRed
{
    color : red;
}
</style>
</head>
<body>
<div class ="colorRed">bla2</div>
</body>
</html>

Demo: http://jsfiddle.net/hsakapandit/2bAKd/

Sign up to request clarification or add additional context in comments.

Comments

1

<div class ="colorRed">bla2</div> should work. Check the path to your css file is correct.

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.