I am trying to make a website and I want to know how to change the size of text in a paragraph. I want paragraph 1 to be bigger than paragraph 2. It doesn't matter how much bigger, as long as it's bigger. How do I do this?
My code is below:
<html>
<head>
<style>
p {
color: red;
}
</style>
</head>
<body>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
</body>
</html>
Give them a class and add your style to the class.
Check this EXAMPLE
You can't do it in HTML. You can in CSS. Create a new CSS file and write:
If that doesn't work make sure you don't have any "pre" tags, which make your code a bit smaller.
Or add styles inline:
If you're just interested in increasing the font size of just the first paragraph of any document, an effect used by online publications, then you can use the first-child pseudo-class to achieve the desired effect.
However, this will change the font size of every p element that is the first-child of any other element. If you're interested in setting the size of the first p element of the body element, then use the following:
The above code will only work with the p element that is a child of the body element.
If you want to do this without adding classes...
or