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 this one:
<h2;"font-family:tahoma">TITLE</h2>but it doesn't work...
What am I doing wrong?
14 Answers
In HTML the style attribute has the following syntax:
style="property1:value1;property2:value2"so in your case:
<h2>TITLE</h2>Hope this helps.
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 declarations. Try this:
<h2>TITLE</h2> 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
<h2 >TITLE</h2>A further example would be as follows
<div class ="row"> <button type="button" style= "margin-top : 20px; border-radius: 15px">View Full Profile</button>
</div> I got stuck on the same issue and I hope this helps someone someday:
<style> .red-text { color: red;} p {font-size: 16px;}
</style> 2