2013-10-24 2 views
1

이것은 정말 실망 스럽습니다! 나는 다양한 체크 박스가있는 폼을 가지고 있으며, 스타일을 정하는 방법을 알아 내려고, 클래스를 추가하고, zend가 생성하는 'dd'및 'dt'태그의 스타일을 시도하고, div 입력 { } '와 다른 모든 방식으로 이것을 작동 시키려고 노력합니다.스타일 젠드 체크 박스

기본적으로 나는 일부 멋진 기능을 추가하기 전 까다로운 체크 박스를 원한다.

/* ------------------- home page checkbox styling ------------------- */ 

.zend_form{ 
    margin-top:-15px; 
    width:260px; 
} 
.indexCheckbox { 
    width: 20px;  
    margin: 20px auto; 
    position: relative; 
} 

.indexCheckbox label { 
    cursor: pointer; 
    position: absolute; 
    width: 20px; 
    height: 20px; 
    top: 0; 
    border-radius: 4px; 

    -webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); 
    -moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); 
    box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); 
    background: #fcfff4; 

    background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); 
    background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); 
    background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); 
    background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); 
    background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0); 
} 

.indexCheckbox label:after { 
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; 
    filter: alpha(opacity=0); 
    opacity: 0; 
    content: ''; 
    position: absolute; 
    width: 9px; 
    height: 5px; 
    background: transparent; 
    top: 4px; 
    left: 4px; 
    border: 3px solid #333; 
    border-top: none; 
    border-right: none; 

    -webkit-transform: rotate(-45deg); 
    -moz-transform: rotate(-45deg); 
    -o-transform: rotate(-45deg); 
    -ms-transform: rotate(-45deg); 
    transform: rotate(-45deg); 
} 

.indexCheckbox label:hover::after { 
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"; 
    filter: alpha(opacity=30); 
    opacity: 0.5; 
} 

.indexCheckbox input[type=checkbox]:checked + label:after { 
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; 
    filter: alpha(opacity=100); 
    opacity: 1; 
} 

CSS는 충분히 가까이 :

public function searchForm() { 
     $sp = $this->createElement('checkbox', 'sw') 
         ->setOptions(
           array(
            'label' => 'Swimming Pool', 

           ) 

         ); 

     $spa = $this->createElement('checkbox', 'spa') 
         ->setOptions(
           array(
            'label' => 'Spa ', 
           ) 
         ); 

     $gym = $this->createElement('checkbox', 'gym') 
         ->setOptions(
           array(
            'label' => 'Gym ', 
           ) 
         ); 

     $wifi = $this->createElement('checkbox', 'wifi') 
         ->setOptions(
           array(
            'label' => 'Wifi ', 

           ) 
         ); 

     $parking = $this->createElement('checkbox', 'parking') 
         ->setOptions(
           array(
            'label' => 'On-Site Parking ', 
           ) 
         ); 

     $golf = $this->createElement('checkbox', 'golf') 
         ->setOptions(
           array(
            'label' => 'Golf ', 
           ) 
         ); 

     $wp = $this->createElement('checkbox', 'wp') 
         ->setOptions(
           array(
            'label' => 'Wedding Packages ', 
           ) 
         ); 

     $cc = $this->createElement('checkbox', 'cc') 
         ->setOptions(
           array(
            'label' => 'Civil Ceremonies ', 
           ) 
         ); 

     $city = $this->createElement('checkbox', 'city') 
         ->setOptions(
           array(
            'label' => 'City Central ', 
           ) 
         ); 

     $oot = $this->createElement('checkbox', 'oot') 
         ->setOptions(
           array(
            'label' => 'Out Of Town ', 
           ) 
         ); 

     $disabled = $this->createElement('checkbox', 'disabled') 
         ->setOptions(
           array(
            'label' => 'Disabled Access ', 
           ) 
         ); 

     $submit = $this->createElement('submit', 'submit')->setOptions(array('label' => 'SEARCH OUR HOTELS', 'class' => 'f-left btn-purple icon')); 

     $this->addElement($sp) 
      ->addElement($spa) 
      ->addElement($gym) 
      ->addElement($wifi) 
      ->addElement($parking) 
      ->addElement($golf) 
      ->addElement($wp) 
      ->addElement($cc) 
      ->addElement($city) 
      ->addElement($oot) 
      ->addElement($disabled) 
      ->addElement($submit); 
    } 
} 

과가 호출되는 HTML :

<div class="indexCheckbox" > 

           <?php echo $this->form; ?> 
          </div> 

마지막에

의 CSS

내 젠드 양식을 보라 원래는이 페이지의 맨 아래에있는 것과 같습니다 (

).

http://cssdeck.com/labs/css-checkbox-styles

는 출력 HTML은 다음과 같습니다

<div class="zend_form" > 
           <p class ="search-title">Facility Filter</p> 
           <form enctype="application/x-www-form-urlencoded" action="" method="post"><dl class="zend_form"> 
<dt id="sw-label"><label for="sw" class="optional">Swimming Pool</label></dt> 
<dd id="sw-element"> 
<input type="hidden" name="sw" value="0"><input type="checkbox" name="sw" id="sw" value="1"></dd> 
<dt id="spa-label"><label for="spa" class="optional">Spa</label></dt> 
<dd id="spa-element"> 
<input type="hidden" name="spa" value="0"><input type="checkbox" name="spa" id="spa" value="1"></dd> 
<dt id="gym-label"><label for="gym" class="optional">Gym</label></dt> 
<dd id="gym-element"> 
<input type="hidden" name="gym" value="0"><input type="checkbox" name="gym" id="gym" value="1"></dd> 
<dt id="wifi-label"><label for="wifi" class="optional">Wifi</label></dt> 
<dd id="wifi-element"> 
<input type="hidden" name="wifi" value="0"><input type="checkbox" name="wifi" id="wifi" value="1"></dd> 
<dt id="parking-label"><label for="parking" class="optional">On-Site Parking</label></dt> 
<dd id="parking-element"> 
<input type="hidden" name="parking" value="0"><input type="checkbox" name="parking" id="parking" value="1"></dd> 
<dt id="golf-label"><label for="golf" class="optional">Golf</label></dt> 
<dd id="golf-element"> 
<input type="hidden" name="golf" value="0"><input type="checkbox" name="golf" id="golf" value="1"></dd> 
<dt id="wp-label"><label for="wp" class="optional">Wedding Packages</label></dt> 
<dd id="wp-element"> 
<input type="hidden" name="wp" value="0"><input type="checkbox" name="wp" id="wp" value="1"></dd> 
<dt id="cc-label"><label for="cc" class="optional">Civil Ceremonies</label></dt> 
<dd id="cc-element"> 
<input type="hidden" name="cc" value="0"><input type="checkbox" name="cc" id="cc" value="1"></dd> 
<dt id="city-label"><label for="city" class="optional">City Central</label></dt> 
<dd id="city-element"> 
<input type="hidden" name="city" value="0"><input type="checkbox" name="city" id="city" value="1"></dd> 
<dt id="oot-label"><label for="oot" class="optional">Out Of Town</label></dt> 
<dd id="oot-element"> 
<input type="hidden" name="oot" value="0"><input type="checkbox" name="oot" id="oot" value="1"></dd> 
<dt id="disabled-label"><label for="disabled" class="optional">Disabled Access</label></dt> 
<dd id="disabled-element"> 
<input type="hidden" name="disabled" value="0"><input type="checkbox" name="disabled" id="disabled" value="1"></dd> 
<dt id="submit-label">&#160;</dt><dd id="submit-element"> 
<input type="submit" name="submit" id="submit" value="SEARCH OUR HOTELS" class="f-left btn-purple icon"></dd></dl></form>       </div> 
          <input type="hidden" name="findroom" id="findroom" value="1"/> 
         </form> 
        </div> 
+0

랩퍼 div에 잘못된 클래스 이름이 있습니다. 그것을'.zend_form'로 변경해보십시오. – Dre

+0

lol, 시도해 보았습니다. 운이 없다! – dyatesupnorth

+0

그게 문제였습니까? 젠드 양식이 실제로 출력하는 HTML을 볼 수 있다면 도움이 될 것입니다. – Dre

답변

0

원래 CSS 규칙이 올바른지 가정 - 그들은 확실히 올바른 볼 - 명백한에 문제가 선택기입니다; Zend가 CSS에있는 것과 동일한 선택기를 출력하지 않습니다. .indexCheckboxinput[type=checkbox].indexCheckbox label ~ label으로 변경하십시오. 그래야 문제를 해결할 수 있습니다. 확인란 이외의 다른 레이블을 추가하면 문제가 발생합니다.

그러면 젠드 출력이 불필요하게 복잡해 보입니다. 출력 된 내용을 수정할 수 있다면 다음과 같은 것을 얻을 수 있습니다 JSFiddle. 트릭은 다음 형제 (+) 선택자를 활용하기 때문에 입력 직후에 레이블을 배치 할 수 있습니다.

+0

예, 스타일링이 쉽습니다 Zend 출력 thats this this! – dyatesupnorth

+0

당신은 * decoraters를보아야 할 것입니다; * Zend가 출력하는 HTML을 변경할 수 있습니다; [here] (http://devzone.zend.com/1240/decorators-with-zend_form/) – Dre

+0

표시 할 체크 박스가 있습니다. 불행히도 체크 스타일링을 표시 할 수는 없습니까? ! – dyatesupnorth

관련 문제