Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Problem with <div> tag?
How do you get a <div> element to center. Not the text in the box but the whole box to move to the center of the page.
Not the text in the <div> tag but the whole <div> element. How do you get it so it is in the center of the page?
2 Answers
- Anonymous1 decade agoFavorite Answer
External CSS way:
div#box {
width: XXpx;
margin: 0 auto;
}
HTML...
<div id="box"> <p>Text stuff here that is NOT center aligned</p> </div>
Embedded CSS way (Between head tags):
<style type="text/css">
div#box {
width: XXpx;
margin: 0 auto;
}
</style>
HTML is the same.
Inline CSS way:
<div style="width: XXpx; margin: 0 auto;"> <p>Text stuff here that is NOT center aligned</p> </div>
Ron
- RelexLv 41 decade ago
<div style='text-align: center;'>Hi!</div>
Should do it!
Hope this helps!
//Relex
Source(s): Personal knowledge