/    Sign up×
Community /Pin to ProfileBookmark

inner width for netscape with css

I have the following code for finding the window height and width if the user is using IE. Is there an equivalant for finding the inner width/height for Firefox/Netscape?

[CODE]
#Flash {
height:expression(body.clientHeight-70+’px’);
width:expression(body.clientWidth-270+’px’);
}
[/CODE]

I really do not want to have to use JS on this.

Thanks –

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JNov 04.2005 — Try the following example in your various browsers to see results


[code=php]
<script type="text/javascript">
<!--

function info4(){
str="<ul>"

if(document.body.clientWidth){
str+="<li>document.body.clientWidth = "+document.body.clientWidth
str+="<li>document.body.clientHeight = "+ document.body.clientHeight
}
if(document.body.offsetWidth){
str+="<li>document.body.offsetWidth = "+document.body.offsetWidth
str+="<li>document.body.offsetHeight = "+document.body.offsetHeight
}
if(window.innerWidth){
str+="<li>Window.innerWidth = "+window.innerWidth
str+="<li>Window.innerHeight = "+window.innerHeight
}
if(window.outerWidth){
str+="<li>Window.outerWidth = "+window.outerWidth
str+="<li>Window.outerHeight = "+window.outerHeight
}
if(document.getElementsByTagName){
str+="<li>document.getElementsByTagName('body')[0].offsetWidth = "+document.getElementsByTagName('body')[0].offsetWidth
str+="<li>document.getElementsByTagName('body')[0].offsetHeight = "+document.getElementsByTagName('body')[0].offsetHeight
}
if(document.documentElement){
str+="<li>document.documentElement.offsetWidth = "+document.documentElement.offsetWidth
str+="<li>document.documentElement.offsetHeight = "+document.documentElement.offsetHeight
}

document.getElementById("display2").innerHTML=str

}
setTimeout("info4()",250)
//-->
</script>

<P>The following examples and may vary depending on which browser you are using to view this page.
<P><center>
<table border="0" width="80%">
<tr valign="top">
<td id="display2" width="50%"></td>
</tr>
</table>
[/code]
Copy linkTweet thisAlerts:
@ray326Nov 04.2005 — You can probably use % positioning and apply negative margins to get the same thing in a more standard way.
Copy linkTweet thisAlerts:
@Mr_JNov 04.2005 — Oops, sorry, didn't notice you didn't want JS
Copy linkTweet thisAlerts:
@BassMasterFlashauthorNov 06.2005 — I did end up however using JS - this was my fix -

[code=html]
<script type="text/javascript">
<!--

var element = "Flash";
var windowHeight = window.innerHeight - 70;
function makeID(id, height) {
var str = "<STYLE TYPE='text/css'>";
str += "#" + id + " {";
str += "height: " + height + "px;";
str += "width: 100%;";
str += "overflow: hidden;";
str += "}";
str += "#mozHeight{ height: "+ height + "px; }";
str += "</STYLE>";
document.write(str);
}
makeID(element,windowHeight);

var agt=navigator.userAgent.toLowerCase();

if ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1)&& (agt.indexOf('compatible') == -1))){
function resize(){
height=window.innerHeight-70;
var a = document.getElementById("Flash");
var b = document.getElementById("mozHeight");
a.style.height = height + "px";
b.style.height = height + "px";
}
setInterval("resize()",250);
}
//-->
</script>

[/code]



Pretty much just initiates my style - then if the user is running mozilla of some form - it resizes every so often. Works great so far -

Later on it gets over-written with my previous css I posted if the user is in IE.

Thanks for the help guys.
×

Success!

Help @BassMasterFlash spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...