HighDots Forums  

Button goes full page width

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Button goes full page width in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrew Poulos
 
Posts: n/a

Default Button goes full page width - 05-22-2009 , 05:25 PM






There's this HTML

<input id="print" type="submit" value="" onclick="printPage();">

and this javascript

if (document.getElementById("print")) {
var prn = document.getElementById("print");
prn.value = str.printbutton;
prn.style.position = "absolute";
prn.style.right = "24px";
prn.style.bottom = "24px";
prn.style.cursor = "pointer";
}

str.printbutton is a string that the user sets earlier.

On IE the button stretches across the entire page, except for 24 pixels
on the right hand side. If a width is set then the button honours it but
as I can't know the button label the user will set beforehand I can't
set a width.

Is there a way to get the button to be only as wide as it needs to be
and no more?

Andrew Poulos

Reply With Quote
  #2  
Old   
rf
 
Posts: n/a

Default Re: Button goes full page width - 05-22-2009 , 07:32 PM






Andrew Poulos wrote:
Quote:
There's this HTML

input id="print" type="submit" value="" onclick="printPage();"

and this javascript

if (document.getElementById("print")) {
var prn = document.getElementById("print");
prn.value = str.printbutton;
prn.style.position = "absolute";
prn.style.right = "24px";
prn.style.bottom = "24px";
prn.style.cursor = "pointer";
}

str.printbutton is a string that the user sets earlier.

On IE the button stretches across the entire page, except for 24
pixels on the right hand side. If a width is set then the button
honours it but as I can't know the button label the user will set
beforehand I can't set a width.

Is there a way to get the button to be only as wide as it needs to be
and no more?
Where is the URL to your example?

Why are you replicating a function that every browser, and just about every
application of any sort, provides for free? Wheels, re-inventing of.

What happens if Javascript is not available? Why are you using javascript
for this anyway? Why not a normal stylesheet?

Why position: absolute? Do you *really* know what that does?

Why change the cursor (in a not cross-browser way) to pointer, which is the
default for submit input elements?

Are you running the browser in quirks mode? We can't tell as you do not
supply a URL.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.