Monday, 17 September 2012

How To Use CSS and HTML in the Same Statement


To use both CSS and HTML in the same statement, but it is considered best to push as much of the formatting as possible into CSS, and the <font> tag is one that people say to avoid. In your example, you can do all the styling with CSS: 

<h1 style="text-align:center; font-family:arial,sans-serif; font-size:large;">Text Here</h1> 

I hope I got that mostly right. There are various ways to specify font size. I chose one that might not be the exact equivalent of size=5. 

Alternatively, you can put a separate style declaration in your page, or even in a separate .css file, which makes it much easier to make site-wide changes. This would style all h1 tags: 

h1 

text-align:center; 
font-family:arial,sans-serif; 
font-size:large; 
} 

0 comments:

Post a Comment