0

in my project I need to right some big text, so in my css file I wrote:

#wrong_answer
{
    color: red;
    font-size: 30;
    font-weight: bold;
}

and in my js file:

function wrong_answer()
{    
    $("body").append("<p id='wrong_answer'>Is not correct</p>");
};

and finaly I got red text, but very-very small and if I change font-size the size of text doesnt changes.

so question is why cant I change font-size?

2
  • have you tried to add a unit? e.g. font-size: 30px ? Commented Sep 30, 2013 at 17:40
  • in my project I need to right some big text You can use something like text-align: right; to right your text. Commented Sep 30, 2013 at 17:42

5 Answers 5

7

30 what? 30px, 30pt, 30%, 30em? You have an invalid property value there.

When using jQuery you can specify just an integer but that's because jQuery treats integers like pixel values, e.g.:

//this will work
$([selection]).css({ fontSize : 30 });

Here are some great docs for font-size: https://developer.mozilla.org/en-US/docs/Web/CSS/font-size

UPDATE

You can use your developer tools (Chrome/Firefox/Safari for sure) to inspect the CSS associated with an element. When an invalid property value is encountered, these developer tools will alert you to the fact.

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

Comments

3

You need to specify the "unit of size" . . .

font-size: 30px;

Comments

2

The CSS declaration font-size: 30 is invalid and ignored by conforming browsers. If you mean pixels, you need to say that:

font-size: 30px

Comments

2

Read this page for better understanding about fonts. http://www.w3schools.com/css/css_font.asp

Comments

1

Should be font-size: 30px or something similar. You need to specify the unit type.

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.