利用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...

6,605 Responses

  1. 비아그라 종류
    비아그라의 주요 종류

  2. kontol表示:

    Right here is the right blog for anybody who would like to find out about this topic. You understand a whole lot its almost tough to argue with you (not that I personally would want to…HaHa). You definitely put a fresh spin on a topic which has been written about for a long time. Wonderful stuff, just wonderful.

  3. 강직도 높이는법
    강직도를 높이기 위해서는 몇 가지 실천할 수 있는 방법이 있습니다

  4. 비아그라 고혈압
    비아그라와 고혈압: 연관성 및 이점 이해

  5. After looking over a few of the blog articles on your site, I really like your way of blogging. I book-marked it to my bookmark website list and will be checking back soon. Please check out my website too and let me know what you think.

  6. Having read this I believed it was extremely enlightening. I appreciate you spending some time and effort to put this article together. I once again find myself personally spending a significant amount of time both reading and leaving comments. But so what, it was still worth it!

  7. 처방전 필요없는 비아그라
    처방전이 필요 없는 비아그라: 무엇을 알아야 할까?

  8. Hi there! I could have sworn I’ve been to your blog before but after going through some of the articles I realized it’s new to me. Anyways, I’m certainly delighted I discovered it and I’ll be book-marking it and checking back often!

  9. Vbrdpi表示:

    atorvastatin online order – buy cheap enalapril where can i buy bystolic

  10. Everything is very open with a clear description of the issues. It was really informative. Your website is extremely helpful. Many thanks for sharing.

  11. I seriously love your site.. Excellent colors & theme. Did you make this amazing site yourself? Please reply back as I’m wanting to create my very own site and would like to know where you got this from or exactly what the theme is called. Cheers!

  12. I’d like to thank you for the efforts you’ve put in writing this blog. I really hope to check out the same high-grade blog posts by you in the future as well. In fact, your creative writing abilities has encouraged me to get my own, personal blog now 😉

  13. bestiptv1表示:

    You’re so interesting! I do not suppose I’ve truly read anything like this before. So good to discover someone with some unique thoughts on this subject matter. Really.. many thanks for starting this up. This web site is something that is required on the web, someone with a little originality.

  14. This is a great tip particularly to those new to the blogosphere. Simple but very precise information… Many thanks for sharing this one. A must read post!

  15. Vdobum表示:

    order tenormin for sale – buy sotalol carvedilol 6.25mg without prescription

  16. memek表示:

    Good blog you have got here.. It’s hard to find good quality writing like yours these days. I truly appreciate people like you! Take care!!

  17. bokep ngentot表示:

    May I simply just say what a relief to uncover somebody that genuinely understands what they’re discussing on the net. You actually realize how to bring an issue to light and make it important. More people ought to read this and understand this side of your story. I was surprised you aren’t more popular because you surely possess the gift.

  18. situs porno表示:

    Way cool! Some extremely valid points! I appreciate you writing this post and also the rest of the website is also really good.

  19. I need to to thank you for this very good read!! I absolutely loved every little bit of it. I have you book marked to check out new things you post…

  20. sh bet表示:

    I’m impressed, I have to admit. Seldom do I come across a blog that’s both educative and amusing, and let me tell you, you have hit the nail on the head. The problem is something too few men and women are speaking intelligently about. I’m very happy I found this during my search for something regarding this.

  21. 구글 계정 판매
    구글 계정 판매, 구글깡통계정 구매, 구글 계정 무한생성 vpn, 구글 깡통 계정 판매, 구글아이디 구매, 구글계정 대량 판매, 구글 계정 거래방법.

  22. There’s certainly a great deal to know about this issue. I love all the points you made.

發佈留言

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