利用Dreamweaver CS5.5設計行動裝置網頁

智慧型手機竄紅、平板電腦普及、行動網路發達,讓上網不再是只需要宅在家裡才能做到的事情,不管是走路、等車、坐車、吃飯、蹲馬桶以及許多的時候,都可以利用這些裝置來進入網際網路的花花世界,所以許多的網站也針對這些行動裝置來製作獨立的頁面,甚至根據螢幕尺寸來最佳化頁面。

iPhone 臉書網站直式
iPhone 臉書網站橫式

上面這兩張圖,就是Facebook為了行動裝置而製作的頁面,左邊是iPhone直拿觀賞,右手邊則是橫拿,可以看到在左邊最上排只看到「個人檔案、訊息、更多」,右邊可看到「個人檔案、訊息、朋友、相片、更多」,橫拿比直拿多出了兩個選項,雖然只是小地方,但設計就是要掌握每一個細節,那我們該如何設計這樣的網頁呢?就讓我們慢慢來體驗吧!

很久很久以前在製作網頁的時候,我們可以在同一個頁面使用不同媒體的CSS樣式表來控制顯示內容,例如:

<link href="css/screen.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/handheld.css" rel="stylesheet" type="text/css" media="handheld" />
<link href="css/print.css" rel="stylesheet" type="text/css" media="print" />

上面的第一行是代表螢幕樣式、第二行為行動裝置樣式、第三行為列印樣式,不過目前有關行動裝置樣式已經因為時代的演進與科技的發達,已經瀕臨淘汰的邊緣了,現在我們製作行動裝置樣式,主要是靠裝置的螢幕寬度來決定不同的樣式表。

在Dreamweaver CS5.5中除了提供多螢幕預覽的模式之外:

Dreamweaver CS5.5 多螢幕預覽
Dreamweaver CS5.5 多螢幕預覽介面

還可以針對不同的螢幕尺寸來設定該使用哪個CSS樣式表檔,只要按下多螢幕預覽上方的媒體查詢按鈕。

Dreamweaver CS5.5 媒體查詢

上面的範例是針對螢幕寬度小於320像素的裝置使用phone.css,螢幕尺寸介於321像素~768像素之間的裝置使用tablet.css,加入了這樣的設定後在頁面內會多出兩段CSS的連結語法:

<link href="css/phone.css" rel="stylesheet" type="text/css" media="only screen and (max-width:320px)" />
<link href="css/tablet.css" rel="stylesheet" type="text/css" media="only screen and (min-width:321px) and (max-width:768px)" />

當然要看你在這兩個CSS中如何設定呈現頁面樣式囉!我的範例是在phone.css裡面將景點圖片的display設為none,另外要注意在<head></head>區段中要加入以下的語法:

<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">

否則在手機橫向後頁面將會被放大,這樣我們的樣式表就會失效,瀏覽的效果可以參考下面的影片:

可以看到在320像素以下景點圖片會被隱藏,而超過這個大小圖片就會自動顯示,大家也可以自行用行動裝置瀏覽這個網址,也準備這個範例的原始檔讓大家下載研究。

You may also like...

5,343 Responses

  1. leak finding表示:

    i appreciate you for telling!. “What is written without effort is in general read without pleasure.” by Samuel Johnson..

  2. 비아그라(실데나필)의 효과를 극대화하는 몇 가지 방법은 다음과 같습니다:

    비아그라의 효과를 극대화하는 방법

  3. 비아그라 데체 약품
    비아그라 대체 약품: ED 치료를 위한 다른 옵션

  4. 비아그라 먹으면 커지나요?
    비아그라 복용 시 성기 크기에 대한 영향

  5. Everyone’s overlooked this main idea. Your writing are helping me in exploring some required facts. You need to keep up your authoring.

  6. Feel free to visit my web page; Daycare Near Me

  7. 20대 비아그라 처방

    20대에 비아그라 처방이 필요한 이유

  8. On March 11, 2022 it was announced that all of the CryptoPunks IP was acquired by Yuga Labs (parent company and creators of the Bored Ape Yacht Club project) for an undisclosed sum.

  9. Hey! I simply wish to give an enormous thumbs up for the good information you’ve got here on this post. I will likely be coming back to your blog for more soon.

  10. I had been honored to receive a call coming from a friend as he observed the important points shared in your site. Looking at your blog publication is a real great experience. Thank you for thinking of readers like me, and I desire for you the best of achievements for a professional surface area. resorts in cuba

  11. 비아그라 대체 약품의 부상
    비아그라 대체 약품의 부상: 안전하고 효과적인 옵션 탐색

  12. I was suggested this blog by my cousin. I’m now not positive whether or not this put up is written by means of him as no one else realize such unique about my trouble. You are wonderful! Thanks!

  13. Way over my head on this. Damn ill have to stare at the net all day now.

  14. 발기부전의 검사와 치료방법

    발기부전의 검사와 치료방법: 남성 건강을 위한 정보

  15. It’s nearly impossible to find knowledgeable people about this subject, however, you sound like you know what you’re talking about! Thanks

  16. 비아그라 효과 있나요?
    비아그라 효과: 남성 건강을 위한 해결책

  17. I discovered your blog internet site online and appearance several of your early posts. Always keep inside the really good operate. I simply additional your Rss to my MSN News Reader. Looking for forward to reading more from you finding out at a later date!…

  18. After study just a few of the blog posts in your website now, and I truly like your method of blogging. I bookmarked it to my bookmark website record and will likely be checking back soon. Pls try my web site as properly and let me know what you think.

  19. 여성용 비아그라

    여성을 위한 비아그라에 대한 진실: 오해와 사실

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。