CSS 2.1 快速導覽 - 可見性 visibility

visibility 性質 (property) 為 CSS 中用來設定元素 (element) 的可見度,有以下的關鍵字 (keyword)

  • visible
  • hidden
  • collapse


visible 為可見, hidden 為隱藏, collapse 則是不可見,會使該元素範圍變成空白。


舉例如下
span.visible {
    color: red;
    visibility: visible;
}

span.hidden {
    color: blue;
    visibility: hidden;
}

span.collapse {
    color: green;
    visibility: collapse;
}

/* 《程式語言教學誌》的範例程式
    http://pydoing.blogspot.com/
    檔名:visual15.css
    功能:示範 CSS 2.1 樣式表的使用 
    作者:張凱慶
    時間:西元 2011 年 7 月 */


我們以下面的 HTML 文件載入
<html>
<head>
<title>網頁標題</title>
<link rel="stylesheet" type="text/css" 
      href="visual15.css">
</head>
<body>
<span>You ever have that feeling where you're not sure if 
you're awake or still dreaming?</span>
<span class="visible">A prison for your mind.</span>
<span class="hidden">Free your mind.</span>
<span class="collapse">Believe the unbelievable.</span>
<span>There is no spoon.</span>
<span>I can only show you the door, you have to walk 
through it.</span>
<span>Choice. The problem is choice.</span>
<span>Then tomorrow we may all be dead, but how would that 
be different from any other day?</span>
<span>I have dreamed a dream, but now that dream has gone 
from me.</span>
<span>Choice is an illusion, created between those with 
power, and those without.</span>
<span>Because I choose to.</span>
<span>Everything that has a beginning has an end.</span>
</body>
</html>

<!-- 《程式語言教學誌》的範例程式
     http://pydoing.blogspot.com/
     檔名:visual15.html
     功能:示範 CSS 2.1 樣式表的使用 
     作者:張凱慶
     時間:西元 2011 年 7 月 -->


瀏覽器 (broswer) 開啟如下



中英文術語對照
性質property
元素element
關鍵字keyword
瀏覽器broswer


您可以繼續參考

JavaScript 範例

定位相關


相關目錄
CSS 2.1 快速導覽
HTML, CSS 教材
首頁


參考資料
http://www.w3.org/TR/CSS21/visufx.html
https://developer.mozilla.org/en/CSS/overflow

沒有留言: