Is the style attribute deprecated in XHTML 1.1? - xhtml

is the style attribute deprecated in XHTML 1.1

No. It's not deprecated in HTML 4 Strict, hence neither in XHTML 1.0 Strict, and there are very few changes from there to 1.1, which includes the feature in the inline style module.

Yes, the style attribute module is deprecated in xhtml 1.1 - for more information http://www.w3.org/TR/xhtml-basic/ - use css instead.

The style attribute was still valid in November 2013

Related

HTML Doctype differences

I've been creating a website in ASP.net using the default template in vs2010 with a Site Master.
I'd been getting strange results where an image with a span under it would not line up as they always had whitespace between them.
I spent hours looking at the markup and finally created a plain .htm file out of desperation and copied my html into it. To my suprise this actually worked so after another hour of comparing the differences I noticed that the template creates the site.master with
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Whereas it creates the .htm file with
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Can anyone explain the difference between Strict (Which causes errors in my layout) and Transitional (Which means the layout is as I expect) and if using Transitional in my aspx pages will cause me any future difficulties down the road?
I do have a warning in VS that states
validation (xhtml 1.0 transitional): element 'h2' cannot be nested within element 'span'
I guess this could be the source of the error when using Strict but I'm not sure how to get around it.
Edit: Here is the block in question that is causing the error
<a href="http://somelink.com">
<img src="Images/test.png alt="Test" />
<span class="Styling for hovering">
<h2>
Test
</h2>
<p>
This Is A Test
</p>
</span>
</a>
I'm trying to create a link that is activated by the image and the text below it. I want to hold the text in a container. That containers background will change when it's hovered over. I also set a fixed size for the span. This is the main reason I need some kind of container around them.
Regardless of which DOCTYPE you use you cannot place a block level element (<h2>) inside of an inline element (<span>). That's why you're getting that error. Since <span> is typically used for styling I suspect you could remove that <span> and use CSS to style the <h2> to appear however you desire.
The short answer?
Traditional = Allow old school deprecated HTML tags like <font>, <center>, <s> and be very forgiving about things in HTML that we're not supposed to do anymore.
Strict = Use css to replace most of those tags, and enforce the rules the way the W3C defines.
The long answer: You can read through the 25+ page specifications for each of the HTML spec types from the W3C, but if you're creating new pages you should probably try to stick to XHTML 1.0 Strict since it's the hip cool wave of the future and Transitional gives some graphic designers the heebie jeebies. :)
W3schools has a pretty good breakdown of what each type means more or less:
XHTML 1.0 Strict This DTD contains all HTML elements and attributes, but does NOT INCLUDE presentational or deprecated elements
(like font). Framesets are not allowed. The markup must also be
written as well-formed XML.
XHTML 1.0 Transitional This DTD contains all HTML elements and attributes, INCLUDING presentational and deprecated elements (like
font). Framesets are not allowed. The markup must also be written as
well-formed XML.

Which MIME type should I use to serve XHTML5 to IE7 and IE8?

I want to use XHTML5 but apparently they two browsers don't accept the application/xhtml+xml MIME type. I read that they will accept text/xml (or application/xml not sure) but it is kind of hackish. So I was wondering if I should just serve HTML5 to IE7 and IE8?
Please don't go on talking about XHTML vs HTML advantages. I know.
XHTML 5 is not a standard. XHTML 2 does prescribe a new doctype, though XHTML 2 is not supported by any modern browsers (as it is largely unfinished).
HTML5Doctor recommends that if targeting an "XHTML5" approach, simply use the HTML5 doctype, which makes sense. The HTML5 doctype is compatible with IE7/8.
http://html5doctor.com/html-5-xml-xhtml-5/
Remember, to use HTML5 (properly) in IE <9, you need to include the HTML 5 shiv.
http://ejohn.org/blog/html5-shiv/
Also, in terms of a MIME type for XHTML5, you MUST serve the content with application/xhtml+xml or application/xml, which older version of IE will NOT support. Thus, if you're trying to take a purist approach, you CANNOT have IE 6/7 support.
My split-the-difference recommendation:
On the server, use an XML-based processing pipeline.
But right before you emit the HTTP response body, convert to the HTML5 serialization.
That means <!doctype html> and no <?xml ...?> nor xmlns directives.
Serve your pages with Content-Type: text/html; charset=utf-8. (Change the value of the charset parameter if you must, but PUT ONE IN, or you risk UTF-7 trickery.)
Don't try to condition any of this on the user-agent.
You get the benefits of XML strictness on the server -- you'll notice if you're generating invalid markup, and it makes it much harder to get quoting wrong -- but you don't have to deal with figuring out which clients will actually honor XML mime types.
Note that you can directly embed SVG and MathML in HTML5 even when you're using the HTML5 serialization (the <svg> and <math> elements are magic).
It doesn't really matter so long as you:
Use one which triggers Standards Mode
HTML 5
XHTML 1.0
HTML 4.01 Strict
** HTML 4.01 Transitional (but not the short form that omits the URI)
Serve code that conforms to the DTD (it makes QA testing that much easier)
… or spec if you use HTML 5 (since there is no DTD)
Follow the Compatibility Guidelines if you serve up XHTML
Using the same Doctype throughout is generally a good idea.
Serving up as application/xhtml+xml to some browsers and the same content as text/html to other browsers is generally a waste of time and effort.

What is W3C latest officially recommended HTML and CSS version, for web development?

What are the latest HTML and CSS specifications officially recommended by the W3C for web development?
Is it XHTML 1.1 and CSS 3?
HTML 4.01, XHTML 1.1, and CSS level 2 are all W3C Recommendations, as are earlier versions of each respective standard.
CSS level 2, revision 1 (i.e. CSS 2.1) is still a candidate recommendation, and CSS level 3 is still a working draft. The W3C provides a handy chart of its progress in CSS.
As you might be able to tell from the dates on the recommendations, the classification system the W3C uses is next to meaningless for real-world applications. You're better off referencing something like QuirksMode to make an informed choice about what technologies you want to use.
W3C doesn't do any recommendations for what to use for web development. They specify standards and recommend browser authors to follow them.
Which standards you choose to use for web development depends on your audience and what their browsers can be expected to support, and also how important it is that all visitors can use all functions on the site.
So, there is no single set of standards that can be recommended for all kinds of web development.
The latest HTML and CSS versions to reach Recommendation status are HTML 4.01 and CSS 2.0.
XHTML 1.1 has also reached Recommendation status, but the hoops you have to jump though to make it HTML compatible (required for IE support) combined with the benefits offered over HTML 4.01 mean that it should be avoided by most authors.
CSS 2.1 has reached Candidate Recommendation status, but should be used instead of CSS 2.0 because it better reflects what browsers actually do. CSS 2.0 reached recommendation status before the rules were changed to require 2 independent, interoperable implementations of a specification before it could advance to Recommendation status.
CSS 3 is a group of specifications, not a specification in its own right. A number of them have reached Candidate Recommendation status, but support is nowhere near as wide as for CSS 2.1.
I don't think there is such a thing as the W3C 'officially recommended' versions for day-to-day usage per se, the W3C is only there to oversee the standardization of technologies (as someone mentioned, CSS 2.1 is still candidate recommendation, but we all use it). The naming of Recommendation and Candidate Recommendation are essentially useless to anyone outside the W3C, unless you're a browser manufacturer or maybe a tools developer.
The latest web standards coming out of the W3C currently, are HTML5 and CSS3. Both are very much in use today, despite what you might hear about 2022. These standards are modular, so browsers can focus on implementing a single module rather than the whole standard (which rarely happens in its entirety anyway). HTML5 is also designed to be completely backwards compatible, and it based on research about how people are actually using HTML today, not how browser manufacturers might want you to be using it.
This means you can use much of the standards now. Some common usages include:
the HTML5 doctype:
<!DOCTYPE html>
omitting type from link and script when you are using the defaults:
<link href="mystyles.css" />
<script src="myscript.css"></script>
In CSS3 you can use properties such as border-radius or box-shadow, browsers which implement these will get the effects and older ones will just see square corners and not know any different.
This means HTML5 and CSS3 are not all-or-nothing solutions, feel free to pick the new bits that work for you and use what you're used to for the rest, your markup will still be perfectly valid and work fine.
W3C Recommendation are
CSS1
HTML 4.01
XHTML1.1
Still in Working Draft stage are:
CSS3
HTML5
Source: http://www.w3.org/TR/
XHTML 1.1 has been a recommendation since May 31st 2001.
HTML 4.01 has been a recommendation since December 24th 1999
CSS 2.1 is actually not a proper recommendation, but a candidate recommendation. In practice most of the 2.1-spec is usable today. The 2.0 spec, however, is a proper recommendation.
As far as I know, W3C does not for instance recommend XHTML before HTML. Both of them are perfectly valid to use.
While we are really looking forward to use HTML5, the funny thing is it will probably not be an official recommendation before 2022. Again, in practice - most of it will probably be fully usable within not too long. Especially when IE9 is done (which it should be soon). The other browsers are implementing and updating the new specification every day.

What are pros and cons, If I choose HTML 5 for all new projects?

Everyone, every blog is talking about HTML 5 and giving solution to use HTML in all browsers including IE6.
Should we leave XHTML 1.0 now and go
for HTML 5 and use JavaScript for IE6 support?
Does all other desktop/mobile browser
except IE6 supports HTML 5 without
adding JavaScript?
Will every browser render CSS written
for HTML 5 elements?
What about Screen- readers?
What are pros and cons to choose HTML 5 for all new projects?
Pros:
It has some nice new features
Cons:
Support for those features is very thin on the ground
QA tools are immature compared to those for XHTML and HTML 4.x
The spec is still changing
Should we leave XHTML 1.0 now and go for HTML 5
I wouldn't. I'd stick to HTML 4.01.
and use JavaScript for IE6 support?
You need JS shims for more than IE6. I think IE8 might still require them - and that's for basic support for things like <article> just so you can apply CSS. Forget about <video> for the new form stuff.
Does all other desktop/mobile browser except IE6 supports HTML 5 without adding JavaScript?
No
A quick test shows that IE8 and Firefox 3.6 don't support <article> (IE8 doesn't appear to make it available for styling, Firefox styles it as display: inline by default)
Will every browser render CSS written for HTML 5 elements?
Not without JS hacks.
What about Screen- readers?
Most will not be able to do anything useful with the new elements
See also http://html5doctor.com/how-to-use-html5-in-your-client-work-right-now/
XHTML works with the HTML5 doctype and you need to change nothing as long as you are serving it as application/xml+xhtml and are using the HTML5 doctype.

Should I Avoid Tags Unsupported in HTML5 If I Am Using XHTML 4.01 Strict?

These elements are not supported in HTML 5 but are supported in XHTML:
acronym big tt
In the future, when I will change my doctype to html 5, then will I not need to replace or change any code to pass validation?
this is also accepted as valid code in an attempt to ease the pain for avid XHTML coders (like myself) who are used to self-closing elements:
<tag type="type" id="name"/>
The same rules apply to <meta> and other self closing elements.
Is it a good idea to avoid HTML 5 unsupported tags, If I am using XHTML 1.0 Strict now?
Yes, it would be a good idea to plan ahead for HTML5 support. Check here for a list of deprecated tags and attributes to avoid.
As far as XHTML syntax (always closing tags, self closing tags, etc) you can continue to use that without worry. HTML5 can be written using standard HTML syntax or XHTML syntax, though it always remains just HTML.

Resources