2011-01-24 2 views
0

나는 내가하는 일을 꽤 잘 모르겠다. 와 선택 상자에서 중간 이동 항목에태그를 선택하기 위해 아이콘 정렬

^ +-------------+  +--------------+ 
| |    | <-- |    | 
    | Select 1 | --> | Select 2 | 
| |    |  |    | 
v +-------------+  +--------------+ 

왼쪽과 오른쪽 아이콘과 아래 ​​화살표 : 나는이 같은 포맷하려는 두 개의 선택 상자와 아이콘의 두 세트를 가지고 왼쪽에있는 선택 1의 항목을 위아래로 이동하십시오. 뭐 CSS 로이 레이아웃을 얻을 수있는 쉬운 방법? 나는 순수한 CSS 솔루션으로 운이 없었던 테이블과 함께 무언가를 해킹 할 수있었습니다. 여기

+0

[jsFiddle] (http://jsfiddle.net)에 테이블 솔루션을 게시하십시오. 그런 식으로 누군가가 똑같이 보이지만 대신 레이아웃에 CSS를 사용합니다. – thirtydot

+0

팁 주셔서 감사합니다 - 전 그 사이트를 보지 못했습니다. 여기 내가 무엇을 위해 노력하고 있어요 : http://jsfiddle.net/rTJHK/4/ – jmricker

답변

0

당신은 이동 :

Live Demo

내가 버튼에 cursor: pointer를 추가하는 자유를했다. 의미 범위에서 보면 <img> 태그를 <a> 태그로 변경하면 더 좋을 것입니다.

다른 브라우저 간의 높이를 일정하게 유지하기 위해 <select> 태그에 size="4" 태그를 추가했습니다.

나는 JS를 만지지 않았다.

IE7/8, Firefox, Chrome, Opera, Safari에서 테스트되었습니다.

CSS :

#container { 
    overflow: auto; 
    background: #ccc 
} 
.buttons { 
    float: left; 
    width: 30px; 
    padding: 0 3px 
} 
.buttons img { 
    cursor: pointer 
} 
.dropdown { 
    float: left; 
    width: 160px 
} 

HTML :

<div id="container"> 
    <div class="buttons"> 
     <img src="http://www.jgrmx.com/cgr/tiles/generic/images/icons/arrow-up.gif" id="up_button"><br> 
     <img src="http://www.jgrmx.com/cgr/tiles/generic/images/icons/arrow-down.gif" id="down_button"> 
    </div> 

    <div class="dropdown"> 
     <select multiple=true id="left" size="4"> 
     <option>Patricia J. Yazzie</option> 
     <option>Michael A. Thompson</option> 
     </select> 
    </div> 

    <div class="buttons"> 
     <img src="http://www.jgrmx.com/cgr/tiles/generic/images/icons/arrow-left.gif" id="add_button"><br> 
     <img src="http://www.jgrmx.com/cgr/tiles/generic/images/icons/arrow-right.gif" id="remove_button"> 
    </div> 

    <div class="dropdown"> 
     <select multiple=true id="right" size="4"> 
     <option>Kevin C. Bounds</option> 
     <option>Patricia J. Yazzie</option> 
     <option>Michael A. Thompson</option> 
     <option>Mark D. Mercer</option> 
     </select> 
    </div> 
</div> 
+0

뛰어난! 감사! – jmricker

+0

아무런 문제가 없었습니다 :) – thirtydot

0

참고 : 친화적 인하지 크로스 브라우저 - JSFiddle.

<style type="text/css"> 
    .form-wrap div { 
     display: inline-block; 
     float: left; // makes it work in IE, but breaks it in Firefox 
     vertical-align: middle; 
    } 
    .form-wrap img { display: block; } 
</style> 

<div class="form-wrap"> 
    <div class="buttons-left"> 
     <img src="http://www.jgrmx.com/cgr/tiles/generic/images/icons/arrow-up.gif" id="up_button"> 
     <img src="http://www.jgrmx.com/cgr/tiles/generic/images/icons/arrow-down.gif" id="down_button"> 
    </div> 

    <div class="select-left"> 
     <select multiple=true id="left"> 
      <option>Patricia J. Yazzie</option> 
      <option>Michael A. Thompson</option> 
     </select> 
    </div> 

    <div class="buttons-mid"> 
     <img src="http://www.jgrmx.com/cgr/tiles/generic/images/icons/arrow-left.gif" id="add_button"> 
     <img src="http://www.jgrmx.com/cgr/tiles/generic/images/icons/arrow-right.gif" id="remove_button"> 
    </div> 

    <div class="select-right"> 
     <select multiple=true id="right"> 
      <option>Kevin C. Bounds</option> 
      <option>Patricia J. Yazzie</option> 
      <option>Michael A. Thompson</option> 
      <option>Mark D. Mercer</option> 
     </select> 
    </div> 
</div> 
+0

[여기] (http://jsfiddle.net/AhRpZ/) 솔루션의 라이브 버전 - IE에서 얼마나 효과가 있었는지 궁금했습니다. 불행히도 IE8에서도 작동하지 않습니다. Firefox에서 쳐다 보입니다. – thirtydot

+0

그래, 너도 그걸 열었을 때 내 대답을 돌진했다. : P 오 잘. – drudge

+0

둘 다 대답했습니다. 감사합니다. 두 분 모두에게 감사드립니다. – jmricker