Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
So I just remembered that people were going on about the main element and whether or not it's a good idea and whether or not we should use it or even have one to begin with. I also remember being against the idea of a main element.
But as I was typing <div id="main", I asked myself, "If I'm applying main to an id, then why not see if the main element has been standardized yet?"
So then I looked it up. HTML5 Doctor says yes we can use it. But from their article, it looks like it's still not fully supported. I know that we can use JavaScript to make things easier for late-comers (browsers not adopting the new Standards as quickly as others) - and I know that Can I use (.com) says the major browsers support it, but has anyone had any issues while using it?
Are there any reasons I'm not aware of why I shouldn't use it?
There is broad support for <main> but if you have to deal with older browsers, the following CSS rule will make it work for them
main {
display: block;
}
The CSS specification requires browsers to treat all elements they don't recognize as inline, so this rule tells them to treat it properly as block instead.
If you need to support a browser so old that it doesn't implement CSS, that's another ballgame.
Not trying to be a smart ass but to elaborate on Stephen Thomas' answer:
If you need to support IE8 or older you might want to add the latest version of the HTML5shiv (if you haven't already) or add this to the head of your page above your stylesheet(s):
<!--[if lt IE 9]>
<script>
(function (d) {
d.createElement('MAIN');
// ... more HTML5 elements
}(document));
</script>
<![endif]-->
And the CSS (as Stephen Thomas already described):
main {
display: block;
}
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I've stumbled about the element on w3schools but as far as caniuse.com told me, the element isn't supported by IE, Opera Mini and the UC Browser for Android.
Would I be better by going with a <main> element or should I stick with a <div id="main">?
caniuse.com told me, the element isn't supported by IE, Opera Mini and the UC Browser for Android
That isn't what it says.
It says "Partial support" and:
Partial support refers to missing the default styling, as technically the elements are considered "unknown". This is easily taken care of by manually setting the default display value for each tag
So if main has the appropriate semantics, then use it. Just make sure to explicitly set display: block.
If the browser doesn't expose the semantics of using main then it will have no semantics, which is the same as a div.
From the looks of it I wouldn't worry about compatibility, unless you are trying to support IE 8 and below.. You can cover all your bases by using both <main role="main"> per MDN
The element is widely supported. For Internet Explorer 11 and
below, it is suggested that an ARIA role of "main" be added to the
element to ensure it is accessible (screen readers like JAWS,
used in combination with older versions of Internet Explorer, will be
able to understand the semantic meaning of the element once
this role attribute is included).
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I just started to seriously study CSS and went through practicing my CSS skills. One particular issue I encountered was the first element on top would usually like to have a margin/padding on certain browsers.
So my question come down to, is it a good practice to do
* {
margin: 0px;
padding: 0px;
border: 0px;
}
on my CSS documents? I am reading mixed answers on this. Some say this makes compatibility across browsers awesome and some say it makes rendering slow (not a good idea on older systems).
EDIT:
I just researched into reset.css it seems very similar to what resetting * would do. I happen to come across normalize.css is that a better alternative to make it compatible across browsers?
EDIT2:
Thanks for all the suggestions. I now understand this issue a little bit more and it seems highly opinionated. It's just a question that will never go away due to the different ways browsers render their content.
it all depends.
* reset, normalize, and reset.css all reset user agent styles. which one is best? depends on your document(s).
* is criticized because it resets everything, but if you don't have much in your document, it doesn't matter.
reset.css is the standard, but this can be overkill if you're not using all the elements it is resetting.
normalize is a lighter version of reset, same applies though.
i use normalize.
You could also use a reset.css in your html. YUI 2: Reset CSS has one you can download or link to.
It basically gives everything default values so there is less of a chance an user's browsers displays something different.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
So say I have a website that was built using tables and specifically width tags (Awful I know). According to w3schools that website isn't using HTML5 because the width is no longer supported. My question is would I need to change that code, because it wouldn't be supported by modern day browsers? Or perhaps because it won't be supported later down the road?
That all depends on what browsers you want your site to support. However, as a practical matter most browsers are going to be backward compatible for a while. Most modern browsers still support very early versions of HTML going back to the mid 90's.
That said, it is always a good idea to make sure you are setting the doctype tag on the page appropriately so the browser knows what it is getting and can accommodate it.
There never was a width tag in HTML. For some elements, the width attribute can be used. There is no change in browser support to it; HTML5 drafts require browsers to support legacy attributes even though those drafts declare them as obsolete. W3schools is unreliable and misleading; see w3fools.
As a general rule I would say no. I haven't read the spec or anything but it sounds like the width tag is being depreciated on tables?
If this site was intended to last 6-7 years without major changes then maybe you might want to futureproof it but it seems rather unlikely that the browser venders will break support any time soon. Too much of the web would be broken.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am designing a website which has to reach old and new browsers. With this in mind should I program in HTML5? Currently the website is only in html 5. The question is: Is it stupid in my case to use HTML5, should I use a "switch"(is this even possible) to redirect old browsers?
The question is, what aspects of html5 do you plan to use?
If your website is mostly static html & javascript, no audio and no embedded video, then I would say it use HTML4.
If your not using any tags in html5 dont rush it, no
If you're trying to reach a broad audience, I wouldn't necessarily jump into HTML 5 yet. It's still not supported widely or consistently enough to rely on it. However, there are several resources available if you want to give it a shot.
When Can I Use... should be a big help. It shows which features of HTML 5 are supported in which browsers fairly clearly. It would probably be good to research further about each tag you plan on using. Learn how the major browsers have implemented the tags, and if there's any quirks or bare-bones implementations that might be an obstacle to the average user.
I've heard Modernizr listed as a means of leveraging HTML 5 elements while maintaining backwards support for old browsers. Do note that I can't testify personally to how well it performs, having never used it before.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
jQuery is cross browser, so it abstract JavaScript.
Is there any library for CSS that cross browser, so if I write for Mozilla Firefox, it will show nicely on any other browser, even older version of ie5, 6 ?
Maybe these two will help:
CSS Reset
Blueprint (demos)
EDIT: Your question is duplicate of: Cross-browser CSS
Check out Frame, a pretty damn good cross-browser CSS framework:
http://frame.serverboy.net/
I have used the 960 Grid system for my last few projects. I highly recommend.
I don't think it's technically feasible to create a (javascript) library that can analyze an entire CSS file and modifies it on the fly to make it work in other browsers, because it would have to:
simulate Firefox' rendering to know what the page should look like,
know about all the rendering quirks of other browsers,
know which change to apply to which style rule to fix the design, which implies it should also have to simulate the rendering of other browsers to validate the fix.
jQuery 'only' has to deal with small aspects of a page's rendering. But making an entire design cross-browser compatible is in a league of its own.
Using CSS resets and frameworks, as the other answers suggested, will help a lot in realizing a cross-browser design. But there's no magic library that will fix your entire design in all browsers. And if there is, I'd love to know about it!
I usually use 960, but a lot of times, like with Wordpress it's too time consuming to implement. A lot of times I'll use a javascript browser hack:
http://rafael.adm.br/css_browser_selector/