10
두 개의 버튼이 화면의 반대쪽에 떠 다니고 있으며, 화면이 축소되면 화면이 잘리는 것처럼 보이게하고 싶습니다. 시각적으로,이 내가 원하는 무엇인가 : 불행하게도"text-overflow : ellipsis"를 플로팅 div에서 사용하는 방법은 무엇입니까?
________________________________________________________________
| |
| |LongTextButtonName| |LongTextButtonName| | When the screen
|_______________________________________________________________| is large
_______________________________________
| |
| |LongTextBu...| |LongTextBu...| | When the screen is small
|______________________________________|
, 지금 나는이 얻을 :
________________________________________
| |
| |LongTextButtonName| |
| |LongTextButtonName| |
|_______________________________________|
나는 CSS 전용 솔루션을하고 싶습니다.
여기에 내 현재 HTML과 CSS (그리고 여기 fiddle) :
<div class="button-container">
<div class="left-button"><a>LongTextButtonName</a></div>
<div class="right-button"><a>LongTextButtonName</a></div>
</div>
.button-container {
min-width:320px;
}
.button-container > div {
border: 1px solid gray;
background-color: orange;
min-width: 160px;
padding: 8px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.left-button {
float: left;
}
.right-button {
float: right;
}
끝내 그! 버튼 주위에는 약간의 마진이 있어야하지만, 그 값을 수정하여 해결할 것입니다. 'box-sizing : border-box'는 무엇을합니까? –
업데이트 된 답변보기 - 브라우저가 컨테이너의 너비를 50 %에서 16px 안쪽 여백으로 설정하도록 패딩을 설명합니다 – PassKit
플로팅 된 div의 축소 된 내용 중 하나를 사용하여이 작업을 수행하는 방법은 무엇입니까? (인라인 블록 디스플레이) –