Why <center> can still work in html 5? - html

<!DOCTYPE html> specifies the page as html 5. But, when I used <center>, it can still center the content. Why <center> can still work in html 5 as I read from http://www.w3schools.com/tags/ that <center> is supposed to not work?

The tag is obsolete since HTML4. But it is still supported in some browsers even now. MDN advices to not use it
Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
Use css text-align: center instead.

It's not part of the specs anymore but it's up to the browser whether or not they still support the tag. Most browsers will to make sure older code still works.
But, since it is deprecated you should not use it in new code. Go with CSS to get your stuff centered.

Browsers may still support it and at some point they will not. Take at look at this page to see if you can use or should use an html element, css property and more: http://caniuse.com/#search=center

Since HTML4, <center>, and other presentation tags (such as <blink>) has been deprecated from HTML specs, and removed in HTML5 specs.
Those tags should be replaced by other content tags (the most abstract one being <div>) in addition to CSS for the styling they did provide.
But since those tags don't lead to any security issue, (contrary to <frame>) they may still be supported by browsers for compatibility issues.
Even if today, google's main page still uses it, you should prefer to use an other content tag with proper CSS styling.

Related

<center> , <dir> tags have been expired in html5 but when i use them, work properly? [duplicate]

<!DOCTYPE html> specifies the page as html 5. But, when I used <center>, it can still center the content. Why <center> can still work in html 5 as I read from http://www.w3schools.com/tags/ that <center> is supposed to not work?
The tag is obsolete since HTML4. But it is still supported in some browsers even now. MDN advices to not use it
Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
Use css text-align: center instead.
It's not part of the specs anymore but it's up to the browser whether or not they still support the tag. Most browsers will to make sure older code still works.
But, since it is deprecated you should not use it in new code. Go with CSS to get your stuff centered.
Browsers may still support it and at some point they will not. Take at look at this page to see if you can use or should use an html element, css property and more: http://caniuse.com/#search=center
Since HTML4, <center>, and other presentation tags (such as <blink>) has been deprecated from HTML specs, and removed in HTML5 specs.
Those tags should be replaced by other content tags (the most abstract one being <div>) in addition to CSS for the styling they did provide.
But since those tags don't lead to any security issue, (contrary to <frame>) they may still be supported by browsers for compatibility issues.
Even if today, google's main page still uses it, you should prefer to use an other content tag with proper CSS styling.

HTML | What is <marquee> and what can i do with it?

I just found out that there is a html tag called <marquee>. I went to several websites including the w3schools and the selfHTML website but couldnt find anything about this tag. IntelliJ wich I'm using to write my websites, doesnot recognise this tag. It says: Unkown html tag marquee. This tag is how I tested compatible with all browsers(even in IE!).
So now I have the following Questions:
What atributes can I use for this tag?
Why isnt this tag on the html-turtorial sites?
If its not in the W3Schools -> who created this tag?
Just that you know what I'm all talking about:
<marquee>Test Marquee</marquee>
<p>Test Paragraph</p>
Thanks for answering
<marquee> is an old HTML element that causes whatever content inside of it to scroll across the viewport from right to left by default.
It may still work in some browsers for backwards compatibility, but it is no longer officially supported in HTML and should be avoided. That's why you are not finding it on tutorial sites. And since it is no longer supported, there is no guarantee that even if it works in some browsers today, it will continue to work in new versions of those browsers tomorrow.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/marquee
The HTML <marquee> element is used to insert a scrolling area of text.
marquee tag is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Highly recommended not to use them with HTML5. Try to avoid using it.
Instead of marquee, you could use alternatives like jquery with css3 or CSS marquee style should be used instead. etc..
See https://developer.mozilla.org/en/docs/Web/HTML/Element/marquee..
The <marquee> tag is used to denote snippets of text or content that you want to scroll on a page.
Taken from MDN:
<marquee>This text will scroll from right to left</marquee>
<marquee direction="up">This text will scroll from bottom to top</marquee>
<marquee direction="down" width="250" height="200" behavior="alternate" style="border:solid">
<marquee behavior="alternate">
This text will bounce
</marquee>
</marquee>
However, you don't really want to use this as there is no guarantee it is supported by all browsers.
It is also considered obsolete:
https://www.w3.org/TR/html5/obsolete.html#the-marquee-element-0
If you want this effect I recommend looking at this answer:
Very Simple, Very Smooth, JavaScript Marquee
The marquee tag was introduced by either Netscape or Microsoft, back then when there was a browser war between Netscape 4 and IE4. It could be part of HTML 3, but definitely not of the HTML 4 Standard.
Nevertheless, current browsers just support it, since the code is already builtin for backwards compatibility.

HTML5 semantic markup ignored in IE7

I'm trying to use semantic tags on my page (http://toytic.com/class/html5_docStructure.html ). I expected them to behave like normal markup tags without any styling information (e.g. display block.
However when I look DOM structure in the IE7 debugger, I see that the tags are imidatly closed and all style attributes are ignored.
I know their are libraries like modinizer, but what I have read so far, they just use the CSS trick, where they set the following CSS attribute, so the browser interprets the semantic elements like normal divs:
header, nav, article, footer, section, aside, figure, figcaption {
display: block;
}
what am I missing?
Old versions of IE that do not understand the new tags in HTML5 require a little JavaScript trick, called a 'shiv', to enable them for display and styling. Setting the CSS to display: block alone will not do the trick.
The HTML5Shiv can be included by itself, or packaged with a wider library such as Modernizr (which you really should be using in any case).
HTMLShiv: http://code.google.com/p/html5shiv/
Modernizr: http://modernizr.com/
You have to use modernizr plugin to give the older browsers fallbacks for HTML5. Just embed it in your head tag script after downloading the minified version. You can also use HTML5 shiv.
I also recommend when you do websites, boot it up with initialzr. It'll give you all the dependencies you need.
Modernizr also uses something comparable to HTML5shiv which adds the elements to the DOM as well. Check out what happens in that JavaScript.
Same thing happened to me. Make sure that "html5shiv v3.6" is checked when you download Modernizr.

HTML5.js for IE7/8 support

I have read a lot about adding HTML5.js for IE7/8 support. Even though the documentation says that adding html5.js just causes IE7/8 to not ignore HTML5 tags and apply the styles.
I am really confused as to what it does, like does it have any impact on CSS3 styles working on IE OR it just causes CSS to be applied to HTML5 elements.
Could i please get to to see an easy example with/without HTML5.js on IE.
html5.js works by creating polyfills via JavaScript that specifically enforce certain rules of html5 elements in browsers that do not support them. but even after the js turns them "on", you are still going to have to target them via css to enforce styles. check out this fiddle in any browser that doesn't support html5, then uncomment out the script element and view it again. you'll see what i'm talking about http://jsfiddle.net/TR8z5/
If I recall correctly, without html5.js, older web browsers will just ignore tags it doesn't recognize, essentially showing nothing. With html5.js, older browsers will recognize html5 tags and will therefore be able to render and apply CSS.
Nope, I guess not.
CSS3 will not work on older browsers, no matter what you do.

Anyone familiar with <center>?

I see this in a website for the first time of life.
Is it supported by all browsers?
It's deprecated as of HTML 4.01 and not supported in XHTML 1.0. Major browsers will support it though.
It's deprecated. Use CSS to center elements. It is supported in all major browsers though...
<center> is not part of the HTML 4.01 standard, so it's likely that some browsers wouldn't understand it.
The more correct way to center text uses the CSS text-align property.
If a browser doesn't understand a tag, it should ignore that tag. So, even if a browser doesn't understand <center>, it should not ruin the web page.
center tag puts the content in the middle of the line. It's kind of old-fashioned. CSS can do this well.