BlairHippo
BlairHippo

Reputation: 9658

Associate ID with Class in CSS

Is there something clever I can do in CSS to indicate that an element with a particular ID should always use one or more classes? Something like:


#user_info_box {
    use-class: ui-widget-content ui-corner-all;
    position: fixed;
    left: 10px;
    ...
}

Only, you know, using actual valid CSS properties.

Upvotes: 2

Views: 466

Answers (4)

Tony
Tony

Reputation: 3289

Check out http://lesscss.org/

it will give you more flexibility with your CSS including something similar to what you are asking.

Upvotes: 1

Boris Guéry
Boris Guéry

Reputation: 47585

You can't do that in CSS, however you may be interested in SASS

#user_info_box {
  @extend .ui-widget-content;
  @extend .ui-corner-all;
  position: fixed;
  left: 10px;
  ...
}

Upvotes: 2

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324610

LESS is perfect for this. Specifically, see "mixins".

#user_info_box {
    .ui-widget-content;
    .ui-corner-all;
    position: fixed;
    left: 10px;
    ...
}

Upvotes: 4

Gho5t
Gho5t

Reputation: 1060

Umm no. You could with javascript/jQuery though.

Upvotes: 0

Related Questions