By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,879 Members | 1,859 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,879 IT Pros & Developers. It's quick & easy.

Which is better to align a text -- DIV or Inline Style ?

100+
P: 296
Hello,

The HTML code is like this -->

Expand|Select|Wrap|Line Numbers
  1. <a href="#searchanchor">Go to Top</a>
I want to position the "Go to Top" in the center .

One way is like this -->

Expand|Select|Wrap|Line Numbers
  1. <div align="center"><a href="#searchanchor">Go to Top</a></div>
Is there any better way ?
Feb 2 '07 #1
Share this Question
Share on Google+
3 Replies


drhowarddrfine
Expert 5K+
P: 7,435
"align=center" is deprecated and you shouldn't use it. Presentational code should be done in CSS. In the <head> of your page do this:

<style type="text/css">
div{text-align:center}
</style>
Feb 2 '07 #2

100+
P: 296
Can I use Inline Styles ?

Like this -->

Expand|Select|Wrap|Line Numbers
  1. <div style="text-align: center">Go to Top</div>
Feb 3 '07 #3

drhowarddrfine
Expert 5K+
P: 7,435
Yes, they are the same thing.
Feb 3 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.