Jump to content

How to put 2 "styles" in one text in HTML


EnterGamingYT

Recommended Posts

To add inline styling to an block element such as h1 you would use

	<h1 style="color : blue; text-align: center;"> Header Text </h1>
	

Otherwise you would use a identifier  such as class or just h1 to target  all h1 tags

	<h1 class="headerstyle"> Header Text </h1>
	

With

	<style>
	.headerstyle {
	color : blue;
	text-align: center;
	}
	</style>
	

 

Link to comment
Share on other sites

  • 2 months later...

Hello,
You can give multiple styles using semicolons(;) to a single element. Following is the example of the same as an inline CSS.
 

<h1 style="color:blue; text-align:center"> Your Text </h1>

In case you want to apply internal CSS then your code will be as follows:
 

<h1 id="header1">Your Text</h1>

#header1 {
  color:blue;
  text-align:center
}

 

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...