Reputation: 18553
I'm studying asp.net mvc 3 (using Razor). One of my *.cshtml views has the following code:
<p align="center">
<input class="actionButtons" type="submit" value="Complete order" />
</p>
The VS2010 C# compiler shows me a "XHTML1.0 Transitional" check message (not an error, not a warning), saying that align
attribute is supposed to be deprecated, and a new construction is recommended.
What is that construction?
Upvotes: 1
Views: 10884
Reputation: 48580
In HTML4
and above align
attribute of p
tag has been deprectaed. You should use
<p style="text-align:center">
<input class="actionButtons" type="submit" value="Complete order" />
</p>
Some other tags and attributes have been deprecated. You can read about them here
Upvotes: 1
Reputation: 9889
You need to switch using CSS rules (if you want to position text in the center inside of the p)
<p style="text-align: center">
But if you want to position p element itself in the center, its need to be width constrained and margins set to auto:
<p style="width: 50%; margin-left:auto; margin-right:auto;">
More on horizontal aligning here.
Upvotes: 2
Reputation: 9323
Basically, the answer to your question is that the "new" way of aligning things in CSS, whether it be text or other elements, is using Cascading Style Sheets (CSS).
You should take a look at this article: Align content with CSS, which explains different techniques for aligning content with CSS and provides links to detailed explanations too.
Upvotes: 1
Reputation: 7747
I think it means "text-align:center"
. Or other way is style="margin-left:auto; margin-right:auto;"
Upvotes: 3