常逛網的朋友大概注意過,有些網站的滑鼠指標不是制式的斜箭頭,而是十字準星、左向箭頭,甚至一個問號。在不同區域換上不同形狀來暗示功能,或藉此替網站建立辨識度,都是相當有效的細節。實作起來並不難。
開啟 Dreamweaver 並打開目標網頁,從主選單進入 Text 下拉選單,選 CSS Style 子選單中的 New Style 新增樣式表。(若頁面已有樣式表,改用 CSS Styles 的 Edit Style Sheet 編輯。)
跳出 New Style 視窗後,Type 欄位有三個單選鈕:
本例只想替頁面上的超連結換指標,因此選 Redefine HTML Tag 並指定 a 標籤,下方 Define 欄選 This Document Only,按 OK。
接著在 Style definition for 視窗中,左側 Category 是樣式類別,我們點進 Extensions,右側 Visual Effect 裡的 Cursor 就是關鍵選項。從下拉選單挑一個指標樣式,按 OK 完成。
當然,這些樣式也能套到其他標籤,或只套用在某一段文字上。如果你對 CSS 不陌生,直接手寫往往更快,尤其當你想在不同位置使用不同指標時。寫法是把樣式掛進具體標籤裡:
<tag style="cursor:mouse_style">
其中 tag 是標籤名稱,mouse_style 換成 hand、crosshair、text、wait 等其中之一。
<span style="cursor:hand">hand:手型</span> <span style="cursor:crosshair">crosshair:十字準星</span> <span style="cursor:text">text:文字游標</span> <span style="cursor:wait">wait:等待</span> <span style="cursor:default">default:預設</span> <span style="cursor:help">help:說明</span> <span style="cursor:e-resize">e-resize:向右</span> <span style="cursor:ne-resize">ne-resize:右上</span> <span style="cursor:n-resize">n-resize:向上</span> <span style="cursor:nw-resize">nw-resize:左上</span> <span style="cursor:w-resize">w-resize:向左</span> <span style="cursor:sw-resize">sw-resize:左下</span> <span style="cursor:s-resize">s-resize:向下</span> <span style="cursor:se-resize">se-resize:右下</span> <span style="cursor:auto">auto:自動</span>
把這段貼進網頁,按 F12 預覽,將滑鼠移到各段文字上方試試,指標應該會依序變成對應的形狀。