Hack Forums
[Help] HTML <center> not centering fully - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: [Help] HTML <center> not centering fully (/showthread.php?tid=4274972)



HTML <center> not centering fully - Drizzy‎‎ - Jun 8, 2014

Hey guys, I have a problem. When I use the <center> tag, it doesn't center it fully. Whatever I try to center is still leaning towards the left side.

[Image: OyDerDX.png]


* - c0nvex - Jun 8, 2014

You shouldn't even be using that tag. It's not supported in HTML5. Use CSS for centering.


* - SirBuck777 - Jun 8, 2014

(Jun 8, 2014 05:49 PM)Convex. Wrote:  You shouldn't even be using that tag. It's not supported in HTML5. Use CSS for centering.

Pretty much this; however, HTML5 does not practice deprecation. There are only features and obsolete features; therefore, <center> may be obsolete, however the specification still requires that browsers support it. So you can continue to use it, but it's considered obsolete and not recommended.

The reason for making <center> obsolete was because the specification is now trying to push web developers into the separation of page content and page styling.

But to solve your problem, we need the code.


* - Herbo - Jun 8, 2014

Convex. Wrote:You shouldn't even be using that tag. It's not supported in HTML5. Use CSS for centering.
This, but maybe its a monitor issue or something?
Send me the website or coding, ill take a look.


* - Neeeeeeeeeel.- - Jun 8, 2014

Use CSS instead.
PHP Code

<?php 
<style>
body{
    
margin: 0;
    
padding: 0;
}
.
container{
    
background-color: red;
    
width: 1024px;
    
height: 100%;
    
margin: 0 auto;
}
</
style>
<
div class='container'></div> 



* - ~Dec - Jun 9, 2014

(Jun 8, 2014 08:12 PM)SirBuck777 Wrote:  Pretty much this; however, HTML5 does not practice deprecation. There are only features and obsolete features; therefore, <center> may be obsolete, however the specification still requires that browsers support it. So you can continue to use it, but it's considered obsolete and not recommended.

The reason for making <center> obsolete was because the specification is now trying to push web developers into the separation of page content and page styling.

But to solve your problem, we need the code.

You're wrong. The <center> tag was deprecated in HTML 4.1 and has been removed from the specification, going on a few years now. It's the browsers themselves that chose to still support it, but not all browsers do.


* - SirBuck777 - Jun 9, 2014

(Jun 9, 2014 02:16 AM)~Dec Wrote:  You're wrong. The <center> tag was deprecated in HTML 4.1 and has been removed from the specification, going on a few years now. It's the browsers themselves that chose to still support it, but not all browsers do.

Oh, my bad. I thought <center> was only recently removed in HTML5 where the specification no longer deprecates features. Sorry!