반응 형 웹 사이트가 있습니다. 두 개의 버튼이있는 페이지 중 하나에서 페이지 크기가 작아 질 때 두 버튼에 모두 맞을만큼 화면 크기가 넓 으면 서로 옆에 있습니다 (예 : 스마트 폰의 경우) 두 번째 버튼 (오른쪽)이 첫 번째 버튼 아래로 이동합니다. 이것은 잘 작동합니다.반응 형 웹 사이트의 가운데 버튼
그러나 단추가 왼쪽 위의 다른 단추보다 위에 놓이면 단추를 가운데에 배치하고 싶습니다.
나는이에 기반 한 : 여기
https://jsfiddle.net/kg2grant/ 코드입니다 : http://jsfiddle.net/erenyener/puA72/2/ 다음
은 JS 바이올린입니다
HTML
<div class="button-wrapper">
<div class="fiftyLEFT" ><button type="submit" class="submit" value="submit" name="submit_button"><span>Search</span></button></div>
<div class="fiftyRIGHT"><button onclick="location.href='https://google.com';" class="submit" style="font-size: 22px; width: 500px" value="show" name="show_button">Google</button></div>
</div>
CSS
button.submit {
border: none;
background-image: linear-gradient(-180deg, #52A1DD 50%, #53A2DE 100%);
border-radius: 100px;
max-width: 90%;
margin-right: 5%;
padding: 8px 10px;
font-size: 26px;
color: #fff;
line-height: 30px;
cursor: pointer;
-webkit-transition: all .15s ease-in-out;
-moz-transition: all .15s ease-in-out;
-o-transition: all .15s ease-in-out;
transition: all .3s ease-in-out;
margin-top: 10px;
z-index: 1;
position: relative;
}
button.submit:hover {
color: #3193e9;
background: #fff;
}
button.submit {
width: calc(.5px + 50vw);
}
button.submit img: hover {
background-color: #C37500;
opacity:0.7 !important;
filter:alpha(opacity=70) !important;
}
.button-wrapper
{
width:100%;
padding-top:10px;
padding-bottom:10px;
display:inline-block;
border: 3px solid black
}
.button-wrapper > .fiftyLEFT
{
width:50%;
float:left;
min-width:50px
}
.button-wrapper > .fiftyRIGHT
{
min-width:400px;
width:50%;
float:left;
white-space: nowrap;
}
나는 많은 것을 시도했다 margin 0 auto
를 좋아하고 다른 콘테이너를 추가하는 것은 그러나 운이 없었다! 귀하의 도움에 미리 감사드립니다.