이것은 어려운 질문입니다. 실용적인 데모가 순서대로 있다고 생각합니다.다른 요소를 조정하지 않도록 div를 강제 배치
나는 HTML 요소의 컬렉션을 가지고 :
div.select-div {
background-color: white;
border: 1px solid #CCC;
vertical-align: middle;
margin-bottom: 10px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
height: 20px;
padding: 4px 6px;
}
div.content-div {
float: left;
overflow: hidden;
background-color: white;
vertical-align: middle;
font-size: 14px;
color: #555;
height: 20px;
width: auto;
}
span.select-button {
cursor: pointer;
display: inline-block;
float: right;
width: 16px;
height: 16px;
margin-top: 2px;
position: relative;
background-color: red; // for testing simplicity, this would be a bg image
}
span.clear-button {
cursor: pointer;
display: inline-block;
float: right;
width: 16px;
height: 16px;
margin-top: 2px;
position: relative;
background-color: black; // for testing simplicity, this would be a bg image
}
텍스트 콘텐츠 사업부에 추가하고, 텍스트 등의 작은 금액에 대해 잘 작동이 CSS를 사용
<div class="outer-div"> // Container
<div class="content-div"></div> // Text goes into this element
<span class="clear-button"></span> // BG image for this is a 16x16 icon
<span class="select-button"></span> // BG image for this is a 16x16 icon
</div>
:
하지만 당신은 더 많은 텍스트를 추가하는 경우,이 일 :
는 내가 자신의 위치에서 이동하는 아이콘을 중지 할 수있는 방법을 찾기 위해 노력하고 내 머리를 찢어 봤는데,하지만 난 그것을 해결하지 못할. 이상적으로 div를 세로로 확장하고 싶지만 오버플로 텍스트를 그냥 숨기면 괜찮을 것입니다. 외부 div 너비가 다를 수 있습니다.
적어도 하나의 span 요소는 0이 아닌 오프셋 (오른쪽)을 필요로합니다. 그렇지 않으면 그들은 서로의 위에 쌓아 올 것이다. –