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:
I have tried this one:
<h2 style="text-align:center";"font-family:tahoma">TITLE</h2>
but it doesn't work...
What am I doing wrong?
You can add multiple styling properties at once when using the HTML style attribute - just make sure to separate the name-value pairs with commas. Using a separate stylesheet is very convenient for styling multiple pages, as it's easier to apply changes to one document than to each page separately.
Answer. Yes, you can apply more than one stylesheet to an HTML file. For each stylesheet you link to a page, you would just need to add an additional <link> element.
Here all the property and value pairs are separated by a semicolon (;). You can keep them in a single line or multiple lines. For better readability, we keep them on separate lines.
By using a single CSS rule in a <style> tag or a separate CSS file, you would only need to change it in one place. You gain the most flexibility and power by putting your CSS in a separate CSS file. If you <link> to that CSS file on more than one HTML page, you can reuse the same stylesheet for multiple pages.
In HTML the style attribute has the following syntax:
style="property1:value1;property2:value2"
so in your case:
<h2 style="text-align:center;font-family:tahoma">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 style="text-align:center; font-family:tahoma">TITLE</h2>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With