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.

Nisse Engström
  • 4,738
  • 23
  • 27
  • 42
  • 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. – Le-roy Staines Nov 09 '14 at 08: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. – Le-roy Staines Nov 09 '14 at 08:55
  • It's in a stylesheet: #largefont{ font-size: 24px; font-family: serif; } It's in an attached style sheet. http://user2cis133.achins.com/homework%20nov8/style.css – Blind Guardian 117 Nov 09 '14 at 09:11
  • I added the main code. Let me rewrite the question. – Blind Guardian 117 Nov 09 '14 at 09:15
  • Much better! Now we can see the problem straight away. You cannot nest

    elements.

    – Le-roy Staines Nov 09 '14 at 09:26
  • Ahh thank you. I wasn't aware of that. I can I nest div tags? Like in lieu of the paragraph tag can I put a div tag? I need the font to change for everything BUT the header which is in the body tag. Thanks in advance. – Blind Guardian 117 Nov 09 '14 at 19:44
  • Yes, you can nest div elements. But why don't you just set a global font-size i.e. * {font-size:1.1em;} then set a specific font size for the header? Instead of the other way around... – Le-roy Staines Nov 09 '14 at 22:12

3 Answers3

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.

Nisse Engström
  • 4,738
  • 23
  • 27
  • 42
Le-roy Staines
  • 2,037
  • 2
  • 22
  • 40
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; 
}
Nisse Engström
  • 4,738
  • 23
  • 27
  • 42
Holly
  • 7,462
  • 23
  • 86
  • 140
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.

Nisse Engström
  • 4,738
  • 23
  • 27
  • 42