Click here to Skip to main content
15,907,874 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
Please how can I align more text than just body text? For example one piece of text aligned to center and some text below aligned to left. Sorry for my english and thanks for every help :).
Posted

1 solution

The normal way to do this is to separate the text content that you want aligning into their own div areas (div being the HTML tag that you would apply). Each of these tags would have their own styling simply by giving them unique ids*.

Now, the interesting thing with stylesheets is that they are cascading - this means that you can define a base style which gets applied to all the div elements, and then you simply need to apply your custom styling to those elements that need to be different:
CSS
@font-face
{
  font-family: MyFont;
  source: ('SegoUI.ttf');
}

div {
  font-family: MyFont, verdana, arial, helvetica, sans-serif;
  font-size: 0.98em;
  text-align: justify;
}

div.standout {
  font-size: 1.2em;
  font-weight: bold;
  text-align: right;
}
*This is a slight redundancy because an id must be unique in HTML. If you need to apply the same style to more than one element you would use a class instead.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900