利用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,412 Responses

  1. 트위터 계정 판매
    트위터 계정 판매, 트위터 계정 매입, 판매 가격, 생성프로그램。
    트위터 계정 구매, 트위터 계정 무한생성。

  2. 네이버 아이디 구매
    네이버 아이디 구매,네이버 아이디 판매 ,네이버 아이디 구매,네이버아이디매입,네이버 아이디 판매 

  3. 네이버 아이디 구매 비실명 ID 계정 판매
    네이버 아이디 구매

  4. 고품질의 정통 의약품을 제공한다는 평판을 바탕으로 비아그라 store은 귀하의 건강과 만족을 최우선으로 생각합니다.
    회사소개

  5. 페니실린, 항암제, 보톡스, 비아그라의 '전쟁 기여도'는?  
    페니실린, 항암제, 보톡스, 비아그라: 의학 분야에서의 중요성과 역사적 기여도 비교

  6. 비아그라 약국 판매가격
    비아그라 비용 절감을 위한 최고의 가이드: 약국판매 가격 분석

  7. 약국에 도착하면 처방전을 약사에게 제출하고 비아그라 구매할 의향을 밝힙니다. 약사는 처방전을 확인하고 비아그라를 제공합니다.

  8. 조루 원인 발기력 저하 예방
    조루 원인과 발기력 저하 예방: 건강한 성기능 유지하기

  9. 네이버 아이디 구매 란?
    네이버 플랫품에서 사용되는 아이디를 구매할 수 있습니다.

  10. 비아그라 약국
    약국에서 비아그라 구매하기: 절차, 가격 및 주의사항

  11. 비아그라 용량 이해
    비아그라의 25mg, 50mg 및 100mg의 차이 해결

  12. 20대 비아그라 처방
    20대에서 비아그라 처방: 성 기능과 건강의 논란

  13. 비아그라 부작용 탈모
    비아그라와 탈모: 부작용과 과학적 근거

  14. 인도 비아그라
    인도의 비아그라: 사용을 둘러싼 법적 및 윤리적 고려 사항

  15. 비아그라 정품 구별법
    정품 비아그라 식별을 위한 최고의 가이드: 팁과 요령

  16. 네이버 아이디 판매
    저희는 네이버 아이디 판매 전문 업체입니다.
    우리는 귀사의 요구를 총족시키기 위해 최선을 다하고 있습니다.

  17. 비아그라 구매 필요한지 여부를 결정합니다. 여러분의 증상과 의료 기록을 기반으로 비아그라가 적합한지를 평가하게 됩니다.

  18. 비아그라 간수치
    비아그라가 간 기능에 미치는 영향 이해

  19. 비아그라 먹으면 크기
    진실 밝히기: 비아그라에서 크리가 정말 중요합니까?

  20. . Dutt, Dr S비아그라 구매.K. Kapur, D비아그라 구매r B.M. Sharm비아그라 구매a an

  21. Ztjqaq表示:

    buy cytoxan – buy trimetazidine trimetazidine medication

  22. Rcfdqu表示:

    buy norpace generic – order chlorpromazine 100mg generic cost thorazine 100mg

  23. I would like to express some appreciation to this writer just for rescuing me from such a challenge. As a result of looking out through the internet and getting techniques that were not helpful, I was thinking my entire life was over. Being alive without the approaches to the difficulties you’ve sorted out through this posting is a serious case, as well as the kind that would have badly damaged my career if I had not encountered your website. Your know-how and kindness in taking care of a lot of things was excellent. I am not sure what I would’ve done if I hadn’t come upon such a step like this. I am able to at this time look ahead to my future. Thanks for your time so much for this skilled and effective help. I will not hesitate to endorse your web sites to any individual who should get care on this problem.

  24. Wow that was really interesting, altought i would add few more deeper thoughts

  25. You have some real insight into the things you write about. Do you need many drafts to make a post?

  26. An impressive share, I merely given this onto a colleague who had been performing a small analysis within this. And the man in fact bought me breakfast since I ran across it for him.. smile. So let me reword that: Thnx for your treat! But yeah Thnkx for spending any time to talk about this, I’m strongly over it and love reading read more about this topic. When possible, as you grow expertise, do you mind updating your blog with an increase of details? It truly is extremely useful for me. Massive thumb up in this article!

  27. Hi everyone, it’s my first visit at this web page, and article is actually fruitful for
    me, keep up posting these articles or reviews.

  28. This really is a marvelous write-up. Many thanks for making the effort to detail all of this out for us. It’s a great guide!

發佈留言

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