Current location: Hot Scripts Forums » General Web Coding » CSS » Width and Height of form elements


Width and Height of form elements

Reply
  #1 (permalink)  
Old 10-14-08, 10:57 PM
in2mobi in2mobi is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Width and Height of form elements

I am wondering where can I find out what the default height and width of form elements are? I am going to play around with styling the actual elements to see what css properties can be applied, but for times sake I am hoping that somebody knows or can point me in the right direction on this topic.
Reply With Quote
  #2 (permalink)  
Old 10-14-08, 11:40 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by in2mobi View Post
I am wondering where can I find out what the default height and width of form elements are?
I believe it depends on what default font is used, since form elements initially get their dimensional attributes from the font spec.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #3 (permalink)  
Old 10-18-08, 09:04 AM
ianbrind ianbrind is offline
Wannabe Coder
 
Join Date: Jul 2008
Location: Somerset UK!
Posts: 192
Thanks: 0
Thanked 0 Times in 0 Posts
You can set their widths and heights in px in css
Reply With Quote
  #4 (permalink)  
Old 10-21-08, 05:49 AM
formula formula is offline
New Member
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Javascript shoult do the trick
Reply With Quote
  #5 (permalink)  
Old 10-21-08, 06:05 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
You can find the width of your input elements like this:
Javascript Code:
  1. <input id="in1">
  2. <script>
  3. var in1 = document.getElementById("in1");
  4. alert("innerWidth = "+in1.clientWidth+" - innerHeight = "+in1.clientHeight+"\nouterWidth = "+in1.offsetWidth+" - outerHeight = "+in1.offsetHeight);
  5. </script>
__________________
Jerry Broughton
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting to ems spyke01 CSS 0 11-09-07 02:48 PM
Print CSS Webpage in IE6 TheScreenSaver24 HTML/XHTML/XML 1 07-06-07 11:24 AM
Firefox and align problems gigafare CSS 12 01-07-07 11:22 AM
link color.... stormshadow CSS 8 10-19-06 02:47 PM
span's width and height are 0! davidklonski JavaScript 0 06-30-04 03:50 AM


All times are GMT -5. The time now is 02:16 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.