Reputation: 1094
In html (specific browsers), some elements CANNOT be aligned using the attribute "align=middle" directly.
Therefore, i sometimes use <p align="middle"><!--some elements--></p>
to align a element.
Is this good? Is there other method, e.g. using css, to align element, would be better?
Any help will be appreciated.
Upvotes: 0
Views: 77
Reputation: 1822
For a, p and div tags best solution would be CSS align|pos(center, left, right...); As Frankenscarf's reply; ...
Divs;
<div align="center">....</div>
For forms you should use margin. Using margin to put something in the middle requires a width. Example: (Would recommend percentages for responsiveness)
width: 500px
margin: 0 auto 0 auto;
Upvotes: 1
Reputation: 1219
It's best to use CSS, like this:
<p style="text-align:center">...</p>
The "align" attribute for elements like <p>
is no longer supported in HTML5.
Upvotes: 1