Home > Software engineering >  Changing font size and colour in the same line in html
Changing font size and colour in the same line in html

Time:02-03

I’m completely new to html and have just learnt how to change the font size or colour in a body of text by doing:

<h1 style=“color:red”>example<h1/>

Is there any way to add a font size change to this line? Any help is appreciated.

Thanks

I tried to add them side by side and then underneath too. E.g:

<h1 style=“color:red”;style=“font-size:10px”>example<h1/>

And

<h1 style=“color:red”
    style=“font-size:10px”
    >example<h1/>

These didn’t work. I’m sure its a stupid problem but I’m really new and I’m just trying to grasp how things work.

CodePudding user response:

Let me help you.

It's quite simple to put two different ones, you just have to use ";"

ex: <h1>example</h1>

For 10px and red color you need to use this ";". Separation

<h1 style="color:red;font-size:10px">example</h1>

CodePudding user response:

https://www.codecademy.com/article/html-inline-styles

 <h1 style="color: red; font-size: 10px;">example<h1/>
  •  Tags:  
  • html
  • Related