| | |
Refer to button text via CSS
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2008
Posts: 56
Reputation:
Solved Threads: 1
Hello!
I was wondering if there's any way to refer to a button's text in css. More accurately, to define to classes for a button, one for the button body, and one for the text inside it. Like:
Is there any method (eg. using spans, etc...)?
Thanks in advance!
I was wondering if there's any way to refer to a button's text in css. More accurately, to define to classes for a button, one for the button body, and one for the text inside it. Like:
css Syntax (Toggle Plain Text)
.button{ //the settings of the button } .button: p { //text layout }
Is there any method (eg. using spans, etc...)?
Thanks in advance!
Last edited by peter_budo; Mar 21st, 2009 at 3:07 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Hi there,
You would do what you have done, and create a class, and simply state the attibutes you would like to attribute to the text/font. Because a form submit button is a type of input field you cannot add tags like <span>, or <p> to it, because its text is contained within the value of the input field.
But i get the hunch you are trying to achieve something specific, so if you care to ellborate, please do so
...
Cheers!
Clarity
You would do what you have done, and create a class, and simply state the attibutes you would like to attribute to the text/font. Because a form submit button is a type of input field you cannot add tags like <span>, or <p> to it, because its text is contained within the value of the input field.
But i get the hunch you are trying to achieve something specific, so if you care to ellborate, please do so
...Cheers!
Clarity
css Syntax (Toggle Plain Text)
button { color:#ff0000; background-color: #e4e0d8; } button:hover { color:#000000; background-color: #66cdaa; } button:active { color:#ff00ff; background-color: #66cdaa; } button:focus { background-color: #66cdaa; } /* or */ input[type=button] { color:#ff0000; background-color: #e4e0d8; } input[type=button]:hover { color:#000000; background-color: #66cdaa; } input[type=button]:active { color:#ff00ff; background-color: #66cdaa; } input[type=button]:focus { background-color: #66cdaa; }</style>
and can be css-ed as a span
<button><span style='whatever' or class='whatever'>button text</span></button> Last edited by almostbob; Mar 22nd, 2009 at 3:27 pm.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
wowzah... Ive never seen css like this:
'
Didnt know you could do that. How amazing. Thanks!!
HTML and CSS Syntax (Toggle Plain Text)
input[type=button] { color:#ff0000; background-color: #e4e0d8; } input[type=button]:hover { color:#000000; background-color: #66cdaa; } input[type=button]:active { color:#ff00ff; background-color: #66cdaa; } input[type=button]:focus { background-color: #66cdaa; }
Didnt know you could do that. How amazing. Thanks!!
what can I say, I like turquoise
mouseovers
most elements have four css states
many have more
Drop Caps bold first line paragraphs on screen, plain text on paper
class dontshow/print dont display on screen/paper change layouts to suit media
onscreen forms have a captcha field to verify, printed versions have a signature line
what you can do is limited by what you can imagine
mouseovers
most elements have four css states
many have more
css Syntax (Toggle Plain Text)
@media print { .dontprint { display:none; } p { padding: 1px; font-size: 100%; list-style-type: square; } } @media screen ( .dontshow { display:none; } p { padding: 1px; font-size: 100%; line-height:125%; list-style-type: square; } p:first-line { font-weight:bold; } p:first-letter { font-size:200%; float:left; } }
class dontshow/print dont display on screen/paper change layouts to suit media
onscreen forms have a captcha field to verify, printed versions have a signature line
what you can do is limited by what you can imagine
Last edited by almostbob; Mar 23rd, 2009 at 2:12 am.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
HTML and CSS Syntax (Toggle Plain Text)
Somewhat off topic
trying to get my FIRST page to load fast, subsequent ones load the cached css and js, zoom, discovered apache mod_deflate mod_gzip, marvelous invention
DANGER attempted humor
If (apache config) {enable mod_deflate | mod_gzip, for all text files} else { gzip with asp or php } remarkable load time difference, Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
Similar Threads
- Move Javascript Variable to PHP (JavaScript / DHTML / AJAX)
Other Threads in the HTML and CSS Forum
- Previous Thread: stop html background image cutting off at lower resolutions
- Next Thread: Leave sidebar and title bar but change main content
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7






