0

* {
	padding: 0px;
	margin: 0px;
	font-family: Calibri;
}
#largefont{
	font-size: 24px;
	font-family: serif;
}
<p id="largefont">
<p>TEXT text</p>
...
</p>

It's actually a live website I'm doing for a HTML/CSS class. You can view it here:

http://user2cis133.achins.com/homework%20nov8/index.html

The basic code is at the top. I set the <p> as id="largefont" and in the CSS doc I set the font family and size. However the font size and style isn't changing. I would like some help figuring out why it isn't working.

7
  • Where are you defining that it should be 1.1? i.e. how, in code, have you told the browser this? As far as I can tell, you have not implemented and CSS styles setting the font size. Commented Nov 9, 2014 at 8:52
  • Also you should define your question more thoroughly to yield a better response here. I think people will downvote this question because it is too generic. It is basically saying "I have a bug, can someone please fix it". You need to define the problem better. For example "I am setting the font size for an HTML element by... [doing this]... but it doesn't seem to be working. Here's a snippet of my code, and a link to a running example. Commented Nov 9, 2014 at 8:55
  • It's in a stylesheet: #largefont{ font-size: 24px; font-family: serif; } It's in an attached style sheet. user2cis133.achins.com/homework%20nov8/style.css Commented Nov 9, 2014 at 9:11
  • I added the main code. Let me rewrite the question. Commented Nov 9, 2014 at 9:15
  • Much better! Now we can see the problem straight away. You cannot nest <p> elements. Commented Nov 9, 2014 at 9:26

3 Answers 3

1

As mentioned in one of your comments you are attempting to apply font-size:24px to a <p> element with innerText='TEXT text'.

Firstly; 24px is not the same as 1.1em as per your question. Please define your question more accurately lest we have to do ALL the work for you.

Your issue is that you have defined a CSS style rule for a particular ID, yet there is no element in your HTML document with this ID.

To make this work, with what you have, you need to give that <p> element the same id that is defined in your style.css rule:

<p id="largefont">TEXT text</p>

EDIT: I just saw you did have another <p> element with that ID however it looks like you tried to nest the <p> elements which is not allowed, so the browser terminated the first <p> before it made it to the second one.

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

Comments

0

It looks like you are missing the closing brace } of your first CSS rule.

* {
    padding: 0px;
    margin: 0px;
    font-family: Calibri;

Add in the closing brace and it and your CSS should work properly.

* {     
    padding: 0px;
    margin: 0px;
    font-family: Calibri; 
}

2 Comments

No it's there, it just didn't copy over.
@BlindGuardian117 Then fix it in your question!
0
<p id="largefont">
<p>TEXT text</p>
...
</p>

The <p> element can not contain another <p>. Since <p> elements do not need a closing tag, your markup is the same as:

<p id="largefont"></p>
<p>TEXT text</p>
...
</p>

where the stray closing </p> tag is an error.

Your style for largefont is only applied to the first empty paragraph, not to the second.

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.