2012-06-16 2 views

risposta

2

si dovrebbe usare

text-align: center 

l'errore è in text-align: centro

5

Faresti impostare text-align:centre

Dovrebbe essere text-align:center

Check demo

+0

Ah, sì, io sono come un R-tard, non posso credere che mi mancava. Grazie! – SparrwHawk

+0

@SparrwHawk Ya era l'unico problema. – freebird

+0

@SparrwHawk Accettalo come risposta corretta se ha funzionato per te – pal4life

11

Aggiungi questo al fondo del tuo violino.

select { 
display: block; 
margin: 0 auto; 
} 

L'auto margine sul lato destro e sinistro centrerà un elemento di blocco all'interno del div padre.

+0

La tua risposta dovrebbe contenere una spiegazione del tuo codice e una descrizione di come risolve il problema. – AbcAeffchen

0

Prova questo:

.center { 
 
    text-align: center; 
 
    /*These options are for the div to be visible in the example, the important is the first*/ 
 
    border:1px solid black; 
 
    width: auto; 
 
    height: 50px; 
 
} 
 

 
.cmb { 
 
    display: block; 
 
    margin: 0 auto; 
 
}
<div class="center"> 
 
    <select class="cmb"> 
 
    <option value=1>Option 1</option> 
 
    <option value=2>Option 2</option> 
 
    <option value=3>Option 3</option> 
 
    </select> 
 
<div>