這真讓人沮喪!我有一個不同的複選框的表單,我不能爲我的生活弄清楚如何設計它們,嘗試添加類,試着設計zend生成的'dd'和'dt'標籤,嘗試樣式'div input { }'和所有其他方式試圖讓這個工作。如何設計Zend複選框
基本上我只想要一些花哨的複選框,他們一直在尋找kewl,直到我添加了一些表單功能,現在他們看起來很垃圾!
看哪,我的Zend形式:
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:
/* ------------------- 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足夠接近它最初是什麼,我需要它看起來像這個頁面底部的那個:
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"> </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>
判斷你的包裝div有錯誤的類名。嘗試改變它'.zend_form' – Dre
哈哈,試過了,沒有運氣! – dyatesupnorth
是這個問題嗎?如果我們能看到Zend形式的HTML實際上正在輸出,那將會有所幫助。 – Dre