ci sono un po 'costruito nelle funzioni in less.js e mixins da Bootstrap che si potrebbe usare:
Questa è una funzione less.js:
Questi sia provocare:
.test {
background: rgba(245, 126, 32, 0.5);
}
.test2 {
background: rgba(245, 126, 32, 0.5);
}
Oppure utilizzare un mixin bootstrap:
.test3 {
#translucent > .background(#f57e20, 0.5); // use HSLA mixin
}
che si traduce in:
.test3 {
background-color: rgba(244, 123, 31, 0.5);
}
io includere il codice (fisso) per i translucent
mixins qui per l'archiviazione, in quanto (ultimo ho controllato) non è più incluso come di Bootstrap 3.0.0:
// Add an alphatransparency value to any background or border color (via Elyse Holladay)
#translucent {
.background(@color: @white, @alpha: 1) {
background-color: fade(@color, @alpha);
}
.border(@color: @white, @alpha: 1) {
border-color: fade(@color, @alpha);
.background-clip(padding-box);
}
}
Funziona abbastanza bene senza alcun mixin! Bootstrap 3.3. – Corni