Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using Kendo UI with ASP MVC3 to build some forms. I am using the dropdown and datepicker widgets, which are styled larger that standard inputs. To ensure standard textboxes will match, Kendo has provided the .k-textbox class, which when assigned to a textbox, will style it to match the widgets.

I have created a template that does the job but is requiring a little extra coding to handle some conflicts, no biggie. However, I was wondering if there was a way to make an attribute selector (eg: input[type="text"]) inherit the style from another styled class. So could I make input[type=:text"] use the same styles as .k-textbox, without copying all the class data over?

share|improve this question
2  
possible duplicate of Is it possible to reference one CSS class within another? -- short answer: no. –  Felix Kling Jun 12 '13 at 17:30
 
Ok I am just going to use a template. Thanks. –  teahou Jun 12 '13 at 18:48
add comment

1 Answer

You could add your selector to the existing one, separated by a comma:

.k-textbox, input[type="text"] {
   /* classes already written by Kendo */
}

but then you won't be able to easily update this CSS when Kendo updates it.

share|improve this answer
 
Unfortunately kendo has the styles for k-textbox spread over 17 or so different places. –  teahou Jun 12 '13 at 17:54
 
30 occurences in my copy of commons.min.css, yep :/ Still possible with regexp at least in Sublime Text but a bit complicated (you've to capture what is between k-textbox and the next comma and add it to your selector too...) –  FelipeAls Jun 12 '13 at 18:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.