+ -
当前位置:首页 → 问答吧 → 字体和单元格顶部的距离可以用css控制吗?

字体和单元格顶部的距离可以用css控制吗?

时间:2011-04-19

来源:互联网

rt~用等模仿的下拉框。字体和单元格之间(顶部)还有点空间。想吧空间调没。用什么属性啊

作者: dd121011   发布时间: 2011-04-19

margin-top

作者: net_lover   发布时间: 2011-04-19

代码:JScript code

var optDivs=document.createElement("div");
  optDivs.className="tbl-container";
  var objTable=document.createElement("table");
  var objTbody=document.createElement("tbody");

if (options.length > 0){
    for (var i = 0; i < options.length; i++){
      var newOptDiv = document.createElement("td");
      var objRow=document.createElement("tr");
      newOptDiv.name=options[i].value;
      newOptDiv.innerHTML=options[i].innerHTML;
      newOptDiv.title=options[i].title;
      //单元格背景层
      newOptDiv.onmouseout = function() {this.className='smouseOut';val=selectObj.value};
      newOptDiv.onmouseover = function() {this.className='smouseOver';val=this.name;};
      newOptDiv.className="smouseOut";
      newOptDiv.style.width=1000;
      newOptDiv.style.cursor="default";
      newOptDiv.style.fontSize = "12px";
      newOptDiv.style.height="23px";
                                    
      objRow.appendChild(newOptDiv);
      objTbody.appendChild(objRow);
    }

作者: dd121011   发布时间: 2011-04-19

引用 1 楼 net_lover 的回复:
margin-top

这个属性好像不行~~时在单元格内部。单元格高度大概是25px左右,fontxize是12px,但是调低height会在下面挤压字体。字体距离单元格顶部依然有一段的距离调不去。。

作者: dd121011   发布时间: 2011-04-19

热门下载

更多