943,175 Members | Top Members by Rank

Ad:
Sep 4th, 2010
0

How To Fix Google Chrome CSS??

Expand Post »
Hi all..

I just done a website using HTML,CSS and PHP.

For now,my website is only fine to be displayed in Mozilla and IE..

For IE(Internet Explorer), I just fix the css by doing another CSS layout for that.
like this one :
HTML and CSS Syntax (Toggle Plain Text)
  1. <!--[if IE 7]>
  2. <link rel="stylesheet" type="text/css" href="css/ie7.css" />
  3. <! [endif] -->


But I dont know how do i do that for Google chrome?
and i until now,i still have no idea to fix the css for IE by not doing the
<--[if IE 7]> statement..Could you guys tell me how to really code the css to fixing the cross browser platform problem??

or any sources of reference perhaps?

Thank You
Similar Threads
Reputation Points: 6
Solved Threads: 1
Posting Whiz in Training
samsons17 is offline Offline
225 posts
since Oct 2009
Sep 4th, 2010
0
Re: How To Fix Google Chrome CSS??
The golden rule of HTML/CSS coding - your code must be valid. If it already is then there should be no (or very minor) differences between what your site looks at most recent versions of Firefox/Chrome/Safari/Opera/IE9.

If you are sure that you have done everything correctly but still have any problems in other browsers other than IE then you can use Javascript Navigator object or some functionality of Javascript jQuery lib to detect specific browsers. Note that for this to work Javascript must be enabled in client`s browser (imho not a problem since 9x % of users have it enabled).

On the other hand, the best way to solve IE6/7/8 problems is to use conditional tags as you have already done.
Last edited by Varnius; Sep 4th, 2010 at 10:49 am.
Reputation Points: 12
Solved Threads: 5
Newbie Poster
Varnius is offline Offline
20 posts
since Aug 2010
Sep 4th, 2010
0
Re: How To Fix Google Chrome CSS??
This code detects if the browser is Chrome and when it is it loads diffferent style sheet. If you test your pages on Mozilla you could have very minor differences in Chrome so you'll probably have to replace just few lines of code in the stylesheet:
HTML and CSS Syntax (Toggle Plain Text)
  1. <script type="text/javascript">
  2. if (navigator.userAgent.toLowerCase().match('chrome')
  3. document.write('<link rel="stylesheet" type="text/css" href="stylechr.css">');
  4. </script>
stylechr.css is the Chrome stylesheet.
Last edited by george61; Sep 4th, 2010 at 11:12 am.
Reputation Points: 10
Solved Threads: 6
Junior Poster in Training
george61 is offline Offline
59 posts
since Jul 2010
Sep 5th, 2010
0
Re: How To Fix Google Chrome CSS??
sory for a late reply..yeah george61,your post really help me out..
Thank You
Reputation Points: 6
Solved Threads: 1
Posting Whiz in Training
samsons17 is offline Offline
225 posts
since Oct 2009
16 Days Ago
0

chrome and css

Old thread, but the solution provided doesn't and didn't work for me. I am using Chrome 16.
The old solution was
HTML and CSS Syntax (Toggle Plain Text)
  1. <script type="text/javascript">
  2. if (navigator.userAgent.toLowerCase().match('chrome')
  3. document.write('<link rel="stylesheet" type="text/css" href="stylechr.css">');
  4. </script>
I changed the script (by the way, you are missing an end bracket too) to
HTML and CSS Syntax (Toggle Plain Text)
  1. <script type="text/javascript">
  2. if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1);
  3. document.write('<link rel="stylesheet" type="text/css" href="stylechr.css">');
  4. </script>
With this solution, Chrome is identified correctly and the script works.

Hope this helped.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Charlynne is offline Offline
1 posts
since Jan 2012

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Wrapper not stretching?
Next Thread in HTML and CSS Forum Timeline: Website compatibility with IE and Mozilla





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC