Diff CSS styles for diff INPUT TYPE='s?

Discussion in 'ASP .Net' started by A Traveler, Aug 31, 2004.

  1. A Traveler

    A Traveler Guest

    I know in a css file, i can declare a style which will apply to a given HTML
    tag, specifically, i am looking at an INPUT tag. Is there any way in which i
    can create a style section which will apply to a specific *type* of input??
    That is, a section which applies only to [input type=text] or only to [input
    type=check] or whichever?

    Thanks in advance.
     
    A Traveler, Aug 31, 2004
    #1
    1. Advertising

  2. A Traveler

    Hermit Dave Guest

    if you are using asp.net (assuming a. you have a cross posted and b posted
    in asp.net yet... ie yes)
    you use something called webcontrols. you can assign different styles to
    different webcontrols.. yes even if they are of the same type like a textbox
    control (which is rendered as input type = text

    --

    Regards,

    Hermit Dave
    (http://hdave.blogspot.com)
    "A Traveler" <> wrote in message
    news:#...
    > I know in a css file, i can declare a style which will apply to a given

    HTML
    > tag, specifically, i am looking at an INPUT tag. Is there any way in which

    i
    > can create a style section which will apply to a specific *type* of

    input??
    > That is, a section which applies only to [input type=text] or only to

    [input
    > type=check] or whichever?
    >
    > Thanks in advance.
    >
    >
     
    Hermit Dave, Aug 31, 2004
    #2
    1. Advertising

  3. A Traveler

    Thomas Dodds Guest

    use CSS classes then use each unique class with each *type* of input ...


    "A Traveler" <> wrote in message
    news:%...
    >I know in a css file, i can declare a style which will apply to a given
    >HTML tag, specifically, i am looking at an INPUT tag. Is there any way in
    >which i can create a style section which will apply to a specific *type* of
    >input?? That is, a section which applies only to [input type=text] or only
    >to [input type=check] or whichever?
    >
    > Thanks in advance.
    >
     
    Thomas Dodds, Aug 31, 2004
    #3
  4. A Traveler

    A Traveler Guest

    This doesnt actually work. Here is what i have, in my CSS, there is an INPUT
    {} section, then i also have a .noborder{} section. in the input, i declare
    a certain type, so all my textboxes look the same. I then use the .noborder
    class on my checkboxes, because the check boxes look a little dorky with the
    extra border painted around them. Only thing is, the checkboxes STILL wind
    up with the border as defined in input, even though they are overriden with
    a specific class.

    The textboxes and chkbxs are all [asp:textbox or [asp:checkbox. The reason
    is, the CssClass property on the checkbox does not actually apply to the
    ACTUAL checkbox. It applies rather to the combined control which ASP.NET
    renders for a checkbox of a Checkbox and either a Literal control or a Label
    (im not sure if its the Lit or Lbl).


    "Hermit Dave" <> wrote in message
    news:%...
    > if you are using asp.net (assuming a. you have a cross posted and b posted
    > in asp.net yet... ie yes)
    > you use something called webcontrols. you can assign different styles to
    > different webcontrols.. yes even if they are of the same type like a
    > textbox
    > control (which is rendered as input type = text
    >
    > --
    >
    > Regards,
    >
    > Hermit Dave
    > (http://hdave.blogspot.com)
    > "A Traveler" <> wrote in message
    > news:#...
    >> I know in a css file, i can declare a style which will apply to a given

    > HTML
    >> tag, specifically, i am looking at an INPUT tag. Is there any way in
    >> which

    > i
    >> can create a style section which will apply to a specific *type* of

    > input??
    >> That is, a section which applies only to [input type=text] or only to

    > [input
    >> type=check] or whichever?
    >>
    >> Thanks in advance.
    >>
    >>

    >
    >
     
    A Traveler, Aug 31, 2004
    #4
  5. A Traveler

    Hermit Dave Guest

    see it in action different controls having different stylesheets applied to
    different controls
    infact even the same type of controls

    www.steptall.com

    check the links near the shopping bag area. you can dig deeper if you wish.

    --

    Regards,

    Hermit Dave
    (http://hdave.blogspot.com)
    "A Traveler" <> wrote in message
    news:#...
    > This doesnt actually work. Here is what i have, in my CSS, there is an

    INPUT
    > {} section, then i also have a .noborder{} section. in the input, i

    declare
    > a certain type, so all my textboxes look the same. I then use the

    ..noborder
    > class on my checkboxes, because the check boxes look a little dorky with

    the
    > extra border painted around them. Only thing is, the checkboxes STILL wind
    > up with the border as defined in input, even though they are overriden

    with
    > a specific class.
    >
    > The textboxes and chkbxs are all [asp:textbox or [asp:checkbox. The reason
    > is, the CssClass property on the checkbox does not actually apply to the
    > ACTUAL checkbox. It applies rather to the combined control which ASP.NET
    > renders for a checkbox of a Checkbox and either a Literal control or a

    Label
    > (im not sure if its the Lit or Lbl).
    >
    >
    > "Hermit Dave" <> wrote in message
    > news:%...
    > > if you are using asp.net (assuming a. you have a cross posted and b

    posted
    > > in asp.net yet... ie yes)
    > > you use something called webcontrols. you can assign different styles to
    > > different webcontrols.. yes even if they are of the same type like a
    > > textbox
    > > control (which is rendered as input type = text
    > >
    > > --
    > >
    > > Regards,
    > >
    > > Hermit Dave
    > > (http://hdave.blogspot.com)
    > > "A Traveler" <> wrote in message
    > > news:#...
    > >> I know in a css file, i can declare a style which will apply to a given

    > > HTML
    > >> tag, specifically, i am looking at an INPUT tag. Is there any way in
    > >> which

    > > i
    > >> can create a style section which will apply to a specific *type* of

    > > input??
    > >> That is, a section which applies only to [input type=text] or only to

    > > [input
    > >> type=check] or whichever?
    > >>
    > >> Thanks in advance.
    > >>
    > >>

    > >
    > >

    >
    >
     
    Hermit Dave, Aug 31, 2004
    #5
  6. A Traveler

    PJ Guest

    this is a css problem...it would be helpful if you actually included the
    appropriate section of the stylesheet as well as the markup.

    if you have a style defined for input like:

    input {
    border: 1px solid green;
    background: #efefef;
    }

    this style will apply to all <input> elements. if you need to ovverride it
    for a specific set of elements, use a class as you've done.

    <input type="checkbox" class="check" />

    ..check {
    border: none;
    }

    Note, the checkbox will have a background of #efefef because both styles
    apply to the checkbox. However, the checkbox will not have a border,
    because the class style specifically defines a border of "none."

    "A Traveler" <> wrote in message
    news:%...
    > This doesnt actually work. Here is what i have, in my CSS, there is an

    INPUT
    > {} section, then i also have a .noborder{} section. in the input, i

    declare
    > a certain type, so all my textboxes look the same. I then use the

    ..noborder
    > class on my checkboxes, because the check boxes look a little dorky with

    the
    > extra border painted around them. Only thing is, the checkboxes STILL wind
    > up with the border as defined in input, even though they are overriden

    with
    > a specific class.
    >
    > The textboxes and chkbxs are all [asp:textbox or [asp:checkbox. The reason
    > is, the CssClass property on the checkbox does not actually apply to the
    > ACTUAL checkbox. It applies rather to the combined control which ASP.NET
    > renders for a checkbox of a Checkbox and either a Literal control or a

    Label
    > (im not sure if its the Lit or Lbl).
    >
    >
    > "Hermit Dave" <> wrote in message
    > news:%...
    > > if you are using asp.net (assuming a. you have a cross posted and b

    posted
    > > in asp.net yet... ie yes)
    > > you use something called webcontrols. you can assign different styles to
    > > different webcontrols.. yes even if they are of the same type like a
    > > textbox
    > > control (which is rendered as input type = text
    > >
    > > --
    > >
    > > Regards,
    > >
    > > Hermit Dave
    > > (http://hdave.blogspot.com)
    > > "A Traveler" <> wrote in message
    > > news:#...
    > >> I know in a css file, i can declare a style which will apply to a given

    > > HTML
    > >> tag, specifically, i am looking at an INPUT tag. Is there any way in
    > >> which

    > > i
    > >> can create a style section which will apply to a specific *type* of

    > > input??
    > >> That is, a section which applies only to [input type=text] or only to

    > > [input
    > >> type=check] or whichever?
    > >>
    > >> Thanks in advance.
    > >>
    > >>

    > >
    > >

    >
    >
     
    PJ, Aug 31, 2004
    #6
  7. A Traveler

    Steve Fulton Guest

    A Traveler wrote:

    > I know in a css file, i can declare a style which will apply to a given
    > HTML tag, specifically, i am looking at an INPUT tag. Is there any way
    > in which i can create a style section which will apply to a specific
    > *type* of input??
    > That is, a section which applies only to [input type=text] or only to
    > [input type=check] or whichever?


    input[type=text] { /* your styles here */ }

    5.8 Attribute selectors
    <URL:http://www.w3.org/TR/REC-CSS2/selector.html#attribute-selectors>

    Unfortunately, this won't work in IE, even though the CSS2 spec is over
    six years old! You can use it so that clients that implement the spec
    will use your styles, but IE won't; or you can needlessly clutter your
    HTML with code like:

    <input type="text" class="text" ...>

    and use a selector like

    input.text { ... }

    --
    Steve

    Liberty means responsibility. That is why most men dread it.
    -George Bernard Shaw
     
    Steve Fulton, Aug 31, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cyril Vi?ville

    diff Process under diff users

    Cyril Vi?ville, Jun 29, 2004, in forum: Perl
    Replies:
    1
    Views:
    513
    Joe Smith
    Jun 29, 2004
  2. Jerry III
    Replies:
    0
    Views:
    436
    Jerry III
    Oct 15, 2003
  3. Jeff Marken
    Replies:
    1
    Views:
    609
    Jerry III
    Oct 16, 2003
  4. Berrucho
    Replies:
    2
    Views:
    642
    Infant Newbie
    Dec 5, 2003
  5. Austin Ziegler

    [ANN] Diff::LCS 1.1.0, Diff::LCS 1.0.4

    Austin Ziegler, Aug 8, 2004, in forum: Ruby
    Replies:
    3
    Views:
    195
    Austin Ziegler
    Aug 9, 2004
Loading...

Share This Page