iframe去滾動條應該有多種方式,在此簡單總結兩種:
1.在<iframe>標籤中添加scrolling屬性,值爲yes時,有滾動條,值爲no時無滾動條。這種方法簡單,但是頁面估計不怎麼好看。
2.在iframe鏈接的子頁面的body中,
隱藏橫向滾動條:
body{
overflow: scroll;
overflow-x: hidden;
overflow-y: auto;
}
隱藏縱向滾動條:
body{
overflow: scroll;
overflow-x: auto;
overflow-y: hidden;
}
但是有一點注意的就是需要將子頁面的
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">給刪除掉,否則滾動條的auto不會起作用,而是一直顯示。