Skip to content Skip to sidebar Skip to footer

Assigning Multiple Styles On An Html Element

I'm just starting out with HTML and I'm having a trouble assigning multiple styles to a text. I'd like to create a title with two properties: Centered Font: Tahoma I have tried t

Solution 1:

In HTML the style tag has the following syntax:

style="property1:value1;property2:value2"

so in your case:

<h2style="text-align:center;font-family:tahoma">TITLE</h2>

Hope this helps.

Solution 2:

The syntax you used is problematic. In html, an attribute (ex: style) has a value delimited by double quotes. In that case, the value of the style attribute is a css list of selectors. Try this:

<h2style="text-align:center; font-family:tahoma">TITLE</h2>

Solution 3:

You needed to do it like this:

<h2style="text-align: center;font-family: Tahoma">TITLE</h2>

Hope it helped.

Solution 4:

The way you have used the HTML syntax is problematic.

This is how the syntax should be

style="property1:value1;property2:value2"

In your case, this will be the way to do

<h2style="text-align :center; font-family :tahoma" >TITLE</h2>

A further example would be as follows

<divclass ="row"><buttontype="button"style= "margin-top : 20px; border-radius: 15px"class="btn btn-primary">View Full Profile</button></div>

Post a Comment for "Assigning Multiple Styles On An Html Element"