Web Control vs CSS

  • Thread starter Thread starter Hai Nguyen
  • Start date Start date
H

Hai Nguyen

I would like to know if there is a way to apply CSS on a web control
button. I've been lookin up for some examples but seems HTML controls are
more favored. Anybody here can tutor me quickly for mouse over, mouse click
on a web control buton, also feel free to give me opinions for why web
control are not using much CSS
 
Hai,
You certaily can use CSS. In the Solution Explorer for your button (or
other control) locate the CssClass property. You can type the name of
the class in there. Here's an example:

1. Create a text file named myCSSStyles.css and put it in the
application root folder.

2. Open it with the IDE (in Solution Explorer you can locate it in the
root if click the icon to Show All Files in the title bar of the
Solution Explorer.)

3. Type: .btnClass {

font-family: arial;

font-weight: bold;

color:white;

background-color: maroon;
}

4. Save it. "btnClass" could also be anything you like such as
"buttons" or "btnStyle". Doesn't really matter.

5. Type "btnClass" in the CssClass property of the button. Don't use
the . when you refer to it here. It knows how to find "btnClass" by
looking at all the classes in the CSS file that begin with the dot.

Sometimes the CSS will apply immediately in Design View, but sometimes
not. I have no idea why. BUt if you run the form it should have a
button with all the above attributes. Good luck! CSS is the way to go.

~Paul
 
All HTML has issues with older browsers, depending upon your definition of
"older." The first browsers did little more than render text with
formatting.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Problems with older browsers and then problems with non-standard
browswers, sure. CSS1 (as opposed to CSS2) does claim compatibility
with NS4 and IE4, so that seems like a safe way to use CSS. It would
definitely cover most browsers with a fair amount of compatibility. But
then there are the REALLY old browsers, and I tend to not lose sleep
over them because I don't write stuff for the general public. If you
do, then there is a lot to handle, and not just with CSS. That's out of
my league, Bill.

~Paul
 
Back
Top