標籤:style blog http color io ar div sp log
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>如何讓select的樣式也漂亮起來</title><style type="text/css"><!--.select * { margin: 0; padding: 0;}.select { border:1px solid #cccccc; float: left; display: inline; }.select div { border:1px solid #f9f9f9; float: left;}/* 子選取器,在FF等非IE瀏覽器中識別 */.select>div { width:120px; height: 17px; overflow:hidden; } /* 通配選擇符,只在IE瀏覽器中識別 */* html .select div select { display:block; float: left; margin: -2px;}.select div>select { display:block; width:124px; float:none; margin: -2px; padding: 0px;}.select:hover { border:1px solid #666666; //滑鼠移上的效果}.select select>option { text-indent: 2px; //option在FF等非IE瀏覽器縮排2px}--></style></head><body><div class="select"> <div> <select> <option>看見效果了吧</option> <option>看見效果了吧</option> <option>看見效果了吧</option> </select> </div></div></body></html>
CSS —— 相容各個瀏覽器的select的樣式