2012-12-04 8 views
1

너비가 20 % 인 입력 요소가 있는데 가로로 가운데에 놓고 싶습니다. 텍스트 정렬 중심 (부모 요소)을 시도했지만 도움이되지 않았습니다. 여기가 (입력 상자) 모양을 :jquery 모바일에서 요소 가운데 맞추기 방법

enter image description here

이제 요소 코드는 다음과 같다 :이 작업을 수행 할 수있는 방법이

<fieldset class="ui-grid-solo" style="text-align:center !important;"> 
    <input type="number" class="answerIput"/> 
</fieldset> 

있습니까?

답변

4

요소에 margin: 0 auto을 추가하기 만하면됩니다. 고정 폭 블록 요소로, 자동 왼쪽/오른쪽 여백 부모가 상대적으로 중심됩니다

<input type="number" class="answerIput" style="margin: 0 auto;"> 
+0

당신은 모든 코드를하시기 바랍니다 추가 할 수 있습니까? – vlio20

2

사용 마진

<input type="number" class="answerIput" style="margin-left:auto;margin-right:auto;" /> 
관련 문제