align text in <h1> >> help !

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Monopoly
Forum Commoner
Posts: 41
Joined: Wed May 21, 2008 1:19 pm

align text in <h1> >> help !

Post by Monopoly »

Well , maybe this may sound stupid , but how can you align text in <h1> , I mean to have a couple of aligns in the same <h1>.

Example:
<h1><left>text on left</left><right>text on right</right> </h1> Something like this , you got me :oops: :lol: :oops: :oops:

Thank you
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: align text in <h1> >> help !

Post by califdon »

Monopoly wrote:Well , maybe this may sound stupid , but how can you align text in <h1> , I mean to have a couple of aligns in the same <h1>.

Example:
<h1><left>text on left</left><right>text on right</right> </h1> Something like this , you got me :oops: :lol: :oops: :oops:

Thank you
You shouldn't be using a single html element, like <h1>, if you want different alignments. You should use CSS, something more like this:

Code: Select all

...
<style type="text/css">
   div.L  {
      clear:left;
      float:left;
      text-align:left;
      }
   div.R {
      float:right;
      text-align:right;
      }
</style>
</head>
<body>
...
<div class="L">Text on left</div><div class="R">Text on right</div>
 
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: align text in <h1> >> help !

Post by matthijs »

califdon is right. that's why I said in my earlier reply that the method you choose depends on the situation. If it's a small part of a title I want to align, I might use the positioning technique. If it's about multiple columns and boxes, you'd use floated divs.

If you really want to learn this I can recommend to study a book or two about CSS. Maybe "cascading style sheets" by brigs et al. It would really help to understand the basics first.
Post Reply