phppup Posted March 21, 2012 Share Posted March 21, 2012 I have a table with a 3 buttons and want to control the button size uniformly thru CSS. My code below isn't working. Where have I gone wrong? <html> <head> <style type="text/css"> input[type=button] { width: 20em; } </style> </head> <table> <input type='button'> Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted March 21, 2012 Share Posted March 21, 2012 That will work, you must have set the table columns to a specified width or something? Quote Link to comment Share on other sites More sharing options...
Mahngiel Posted March 21, 2012 Share Posted March 21, 2012 you can simply add a class to the input field or address the button to it's tag. http://jsfiddle.net/raqPw/2/ Quote Link to comment Share on other sites More sharing options...
phppup Posted March 21, 2012 Author Share Posted March 21, 2012 It does NOT work!! I just cut and pasted it AGAIN. Change the size in CSS, and nothing happens! Quote Link to comment Share on other sites More sharing options...
phppup Posted March 21, 2012 Author Share Posted March 21, 2012 There are 4,532 buttons. It will take me longer to ADD the CLASS or edit them INLINE than to simple control them by TYPE..... don't ya think??? I thought CSS could do this.... am I wrong? Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted March 21, 2012 Share Posted March 21, 2012 Sure, but you're not giving us the context in which this styling is nested. That little example you posted is incorrectly written and clearly doesn't reflect the actual code. Quote Link to comment Share on other sites More sharing options...
phppup Posted March 21, 2012 Author Share Posted March 21, 2012 Sorry to disappoint you, but this time, that IS the ENTIRE page with the ENTIRE code content. All on page (for now). With three lines of CSS. Shouldn't it work the same as on a page with miles of code?? Of course it should. But it doesn't! WHY? Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted March 21, 2012 Share Posted March 21, 2012 I'm not disappointed, but you should be. http://jsfiddle.net/twcwU/ Quote Link to comment Share on other sites More sharing options...
phppup Posted March 21, 2012 Author Share Posted March 21, 2012 I AM. At least now I know where the coding example came from.... LOL BUT, how come (even after i cut and pasted it) the button SIZE in MY BROWSER is REFUSING to change. There's a glitch somewhere! Any clues?? Quote Link to comment Share on other sites More sharing options...
phppup Posted March 23, 2012 Author Share Posted March 23, 2012 OKAY... so i was 'playing' the other evening, and i DID add a 'CLASS' to one button. After doing this, it accepted the size changes PERFECTLY. I have to assume the group would react similarly. So why will they respond in the CLASS (and in the tagline) but NOT when cirected by TYPE? Why does THAT work on the webpage (see above for the link) but NOT in my own browsers (which I attempted on two versions of IE running two different operating systems?? Any answers? (could it be because I'm on the east coast?? LOL) Quote Link to comment Share on other sites More sharing options...
Mahngiel Posted March 24, 2012 Share Posted March 24, 2012 If those buttons are the only input types on your page, (if you did have other inputs, you could just add a class/id to them to target more specifically) you can style them all by input {}. http://jsfiddle.net/raqPw/3/ Quote Link to comment Share on other sites More sharing options...
UrbanDweller Posted March 25, 2012 Share Posted March 25, 2012 Hey, all I can say is, input[type="button"]{ width: 50px; } NOT input[type=button]{ width: 50px; } Quote Link to comment Share on other sites More sharing options...
haku Posted March 26, 2012 Share Posted March 26, 2012 It also depends on your browser. input[type=button] will not work on at least IE6-8, I haven't checked on IE9. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.