i




 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
apply css without using class property
04-05-2011, 05:47 AM
Post: #1
apply css without using class property
many developers use the css class with class property in each control.
this cause the design code more complex. so to keep the design code simple, instead of applying the class in each control separately, we can mange it just from css file.

Not Recommended
Code:
.ddlClass
{
     -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    border: 1px solid #ABADB3;
    width:203px;
}

how to use?
Code:
<asp:dropdownlist id="ddl_test" runat="server" cssclass="ddlClass" > </asp:dropdownlist >

above code works perfectly but if you have about 100 dropdownlists in your project, i think no one like to write cssclass property in each control.

so the better way is
Code:
select
{
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    border: 1px solid #ABADB3;
    width:203px;
}

Code:
<asp:dropdownlist id="ddl_test" runat="server"> </asp:dropdownlist>
in above code, this will work without any class property and will apply on all dropdown controls.

same for TextBox
Code:
textarea
{
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    border: 1px solid #ABADB3;
    resize: none;
}

Code:
<asp:textbox id="txt_test" runat="server"> </asp:textbox>

for buttons
Code:
input[type="reset"], input[type="submit"]
{
    font: normal 12px verdana, arial;
    color: #000;
    background-color: transparent;
    background-repeat: no-repeat;
    background-image:url('img/btn_bg.gif');
    height: 21px;
    text-align: center;
    width: 91px;
    border:none;
}
this css will work on all buttons.

Note: in all css classes, instead of using class name, use control names.



[Image: 2604595733.png]
Quote
04-05-2011, 10:03 AM
Post: #2
RE: apply css without using class property
Nice One !!!

Cheers!!!!!!
Rajesh Kumar Parbat
Quote
04-05-2011, 03:55 PM
Post: #3
RE: apply css without using class property
good sharing.....

Thanks & Regards,
Quote
04-06-2011, 04:57 AM
Post: #4
RE: apply css without using class property
Nice post .......

Thanks Regards
Shafiur Rahman
http://www.createsoftweb.com
Quote
10-29-2011, 05:20 AM
Post: #5
RE: apply css without using class property
what the meaning of select and textarea...are these like keywords...?/

“A mind stretched by a new idea can never go back to its original dimension.”

Quote
10-29-2011, 12:10 PM
Post: #6
RE: apply css without using class property
yes when asp textbox rendered, it become textarea in html, so you need to apply css every time in textbox, you just write textarea class and write css for your textbox. thats all.

[Image: 2604595733.png]
Quote
08-25-2016, 10:53 AM
Post: #7
Big Grin RE: apply css without using class property
From my point of view (and what I often did), I never write each class for each control. By that, I will determine a global style for all control and write css style.
Quote


Possibly Related Threads...
Thread: Author Replies Views: Last Post
  CSS Menu Without Using Javascript - Css Menu with Dropdownlist raju 1 2,430 09-14-2010 11:55 AM
Last Post: nisar87



User(s) browsing this thread: 1 Guest(s)