|
|
|
|
![]() ![]() |
May 1 2005, 04:58 PM
Post
#1
|
|
|
PhilosopherX ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 106 Joined: 5-February 05 From: Planet X Member No.: 3,613 |
CODE <style type="text/css"> #memoryticker{ width: 448px; } </style> So, I've got this as part of the stylesheet for a JavaScript I'm using (I removed the irrelevant parts of the code for this question). When it's at width:448, it aligns itself properly with the image it's next to perfectly - for FireFox When it's at width:450, it aligns itself properly with the image it's next to perfectly - for Internet Explorer Too see what I'm doing, visit this page: http://gunbound.trap17.com/phpBB You will see News/Updates. That's an image that's 450px wide. Below that is the Javascript, which in Firefox needs to be 448px wide because it has the 1px border on the sides (1px border * 2 + 448 = 450). IE does not add the border pixels to the width, making it 2 pixels short. I need to make it so that [if IE], the style will be width:450 Can I use an [if IE] tag in there somehow? |
|
|
|
May 1 2005, 05:01 PM
Post
#2
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 176 Joined: 26-April 05 From: Manchester Member No.: 6,203 |
I think you can, Chech with the admins/mods.
I have no idea, Accually i di but just cant remember. Thanks, FFC Webmaster, Asad Haider. |
|
|
|
May 1 2005, 05:30 PM
Post
#3
|
|
|
Incest is a game the whole family can play. ![]() Group: [MODERATOR] Posts: 1,216 Joined: 11-February 05 From: Heaven Member No.: 3,709 |
It uses javascript. Here it is:
CODE <script language="javascript"> if (navigator.appVersion.indexOf("MSIE")!=-1) { document.write ("<style type=\"text/css\">") document.write("#memoryticker{") document.write("width: 450px;") document.write("}") document.write("<\/style>") } else { document.write ("<style type=\"text/css\">") document.write("#memoryticker{") document.write("width: 450px;") document.write("}") document.write("<\/style>") } </script> If the browser is any IE version it write's the width having 450px. The user can have any other browser } else { and the width will be set to 448px. If you wish to change the else bit to do Firefox only I believe you to change it to this: From: } else { To: } elseif (navigator.appVersion.indexOf("FF")!=-1) { This may not be correct but I believe so Do you understand? Don't hesitsate to reply if you don't |
|
|
|
May 1 2005, 06:37 PM
Post
#4
|
|
|
Incest is a game the whole family can play. ![]() Group: [MODERATOR] Posts: 1,216 Joined: 11-February 05 From: Heaven Member No.: 3,709 |
I hate to have people think I'm spamming but I made an error when copying the code from on another.
document.write("width: 450px;") in the } else { sector should be document.write("width: 448px;") in accordance with what you specified |
|
|
|
May 2 2005, 03:41 AM
Post
#5
|
|
|
PhilosopherX ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 106 Joined: 5-February 05 From: Planet X Member No.: 3,613 |
That works. I'm familiar with that method, but was wondering if there was something else I could do. But I've just gone ahead and done it this way. Thanks for the help.
|
|
|
|
May 9 2005, 08:59 PM
Post
#6
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 378 Joined: 8-January 05 Member No.: 3,174 |
QUOTE(gunbound @ May 1 2005, 05:58 PM) When it's at width:448, it aligns itself properly with the image it's next to perfectly - for FireFox When it's at width:450, it aligns itself properly with the image it's next to perfectly - for Internet Explorer Try this: CODE #memoryticker{ width: 448px; } html>body #memoryticker{ width: 450px; } Since IE doesn't recognise many CSS selectors you can make hacks like that. IE doesn't understand html>body, so it just ignores the style rule. But Firefox understands it, and in CSS the last rule is the one that counts, Firefox just ignores the first rule. |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
Lo-Fi Version | Time is now: 30th August 2008 - 01:51 AM |