Im at school and also have completed my newbie. I wish to continue web programs like a hobby. I've produce a functioning web application with MS Visual Studio 2010, however i know I have to allow it to be suitable for other browsers.
I recognise that I have to test drive it in other broswers and find out the discrepancies that arise, but how do you fix them. My teacher say I want CSS code for every browser, but how do you do that?
Thanks ahead of time for just about any help
My teacher say I want CSS code for every browser
He's wrong if that is literally what he stated. If guess what happens you are doing, you will get 99% of all things to operate how you want mix-browser. For IE (the problem browser in most cases definition of "mix-browser", you should use conditional comments to load different stylesheets that concentrate on specific IE versions.
Common things people trip on:
- The Box Model
If you are getting issues in a single browser (which browser isn't IE) however it works in another, odds are (although not always) you're making an error somewhere. Before any debugging attempts, always, always validate your html first. Lots of "CSS issues" are really HTML problems that different browsers react to diversely.
After which, there's this website that I have found useful previously:
The approach I personally use would be to write the CSS for my website and test drive it only in the search engines Chrome. You should use Opera 4 too. The main reason I personally use these browsers is when my CSS looks good inside them, I am confident it's standards compliant and it has an excellent possibility of searching good as more recent browsers emerge.
Then, I have a look inside my site in IE. Now, fortunately, you do not really need to bother about IE6 anymore. Almost everyone's disregarding it. So you've to consider your audience. Do you consider many of them would use IE9 or IE8? If you are comfortable with IE9, then it is almost certain your website looks great with no modifications since it is a really standards compliant browser. If you want IE8 compatibility, adding another CSS stylesheet making it therefore it only turns up when the browser is IE. Your tag would seem like this:
<head> <link rel="stylesheet" type="text/css" href="your-main-style.css" /> <!--[if lte IE 8]> <link rel="stylesheet" type="text/css" href="ie8-and-down.css" /> <![endif]--> </head>
So you can now put any style fixes for the reason that stylesheet without harming the design and style inside your primary stylesheet. Bare this to the very least to ensure that it's not hard to maintain.
Being an aside, whether it's only a site that you should enjoy, choose a browser you want and make certain it really works for the reason that. Then just put a note at the end saying what browser shows your website best.
One can market to IE with conditional comments.
For other browsers you should use vendor-prefixed qualities to clearly target individuals browsers
-webkit- etc. Otherwise for non-IE only use standards compliant (x)html and, typically, they will be fine by using it.
Try conditional stylesheets / hacks: http://css-tricks.com/how-to-create-an-ie-only-stylesheet/