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

  1. Trendy bathroom designs encompass several different styles, together with California spa, Scandinavian, Artwork Deco, and retro seems.

  2. 2,000 for heat pumps and heat pump water heaters; biomass stoves and biomass boilers.

  3. Allen, John (four April 2011).

  4. His main contributions to the medium are the elimination of structural or outline-delineating lead by way of the manufacturing of seamless stained glass and, conversely, the production of related works created without glass, formed of calligraphic lead solder on sheet lead.

  5. A fighter aviation group named Normandie-Niemen fought on the Eastern Entrance as part of the Soviet air drive.

  6. I recommend it. Martin says: I can think about only a few issues on this world extra miserable than climbing four flights of stairs out of Mandarake Shibuya empty-handed.

  7. Make certain you will have a schedule in place for lead follow-up.

  8. The Christmas tree is thought to have originated in a play usually carried out in the Middle Ages during the appearance season.

  9. 禿げそう表示:

    Two French Light Infantry Battalions (J.

  10. The rarity ratings have been derived from a statistical analysis of some data I accumulated over a number of years of CED collecting.

  11. The 19th-century home windows of Clayton and Bell are typified by their good luminosity.

  12. Jávor, Bence (November 21, 2018).

  13. Its story revolves round a excessive-college student who can change between two bodies: one fats and ugly, and the other fit and handsome.

  14. I’m very pleased to find this great site. I need to to thank you for your time for this particularly wonderful read!! I definitely appreciated every bit of it and I have you book marked to see new information in your site.

  15. Kotal can be returning to ATK after the 2019 AFC Asian Cup in the January switch window.

  16. La Porte du Theil, loyal to Pétain, flew to metropolitan France, whereas the second sided with the Free French and joined the Military of Africa.

  17. mostbetkzvdSi表示:

    Консультации и помощь доступны на платформе Мостбет | Поддержка клиентов доступна круглосуточно на Мостбет | Поддержка игроков доступна на Mostbet 24/7 | Узнайте, как начать выигрывать с Mostbet прямо сейчас | Простота и удобство – главные преимущества Мостбет | Насладитесь азартом игр и ставок на Мостбет | Регистрируйтесь и получайте приветственный бонус на Мостбет | Оформите онлайн-заказ на ставку и получите бонус на Мостбет | Участвуйте в акциях и получайте бонусы в Мостбет http://mostbetkzcasino.com.kz.

  18. The young girl is in a gingham dress, whereas her sibling is in a striking blue tunic and hat.

  19. It’s a blend of the outdated and the new, the traditional and the fashionable, and this fusion makes the WPT-a hundred and fifty a actually exceptional writing software.

  20. Davidhaf表示:

    Тут можно преобрести купить огнестойкий сейф в москве сейф огнеупорный купить

  21. Scroll Workers (sixteen January 2020).

  22. Cannot decide what to get the little tyke?

  23. 25 August: Crewe drop out of the play-off zone after a 2-0 loss to Leyton Orient.

  24. vespa tft表示:

    I used to be able to find good advice from your blog articles.

  25. “If left sitting with out being cleared out properly, it will probably stretch out the pores over time.

  26. Patricia’s professional tip: Gold Mine has seasonal hours, so be sure to verify occasions before stopping by.

發佈留言

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