利用Dreamweaver CS5.5設計行動裝置網頁
智慧型手機竄紅、平板電腦普及、行動網路發達,讓上網不再是只需要宅在家裡才能做到的事情,不管是走路、等車、坐車、吃飯、蹲馬桶以及許多的時候,都可以利用這些裝置來進入網際網路的花花世界,所以許多的網站也針對這些行動裝置來製作獨立的頁面,甚至根據螢幕尺寸來最佳化頁面。
上面這兩張圖,就是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中除了提供多螢幕預覽的模式之外:
還可以針對不同的螢幕尺寸來設定該使用哪個CSS樣式表檔,只要按下多螢幕預覽上方的媒體查詢按鈕。
上面的範例是針對螢幕寬度小於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像素以下景點圖片會被隱藏,而超過這個大小圖片就會自動顯示,大家也可以自行用行動裝置瀏覽這個網址,也準備這個範例的原始檔讓大家下載研究。
I just like the helpful info you provide for your articles. I will bookmark your blog and check again here frequently. I¡¯m somewhat sure I¡¯ll learn lots of new stuff right right here! Good luck for the following!
https://www.multichain.com/qa/user/carlfrancoh38793
This is a topic that is near to my heart… Thank you! Exactly where are your contact details though?
https://qualified-penguin-dc4vl1.mystrikingly.com/blog/d8de0ddf4f2
ремонт цифрового фотоаппарата
https://www.producthunt.com/@idmall
There is certainly a lot to find out about this issue. I love all the points you made.
Your expertise on this shines through your writing.오피
I blog frequently and I seriously appreciate your content. This great article has truly peaked my interest. I will book mark your website and keep checking for new details about once a week. I subscribed to your RSS feed as well.
I don’t normally comment but I gotta tell regards for the post on this amazing one : D.
Howdy! This blog post couldn’t be written any better! Looking at this post reminds me of my previous roommate! He always kept talking about this. I’ll forward this post to him. Fairly certain he’s going to have a very good read. Many thanks for sharing!
This is a topic that is close to my heart… Take care! Exactly where can I find the contact details for questions?
oral pyridostigmine 60 mg – purchase sumatriptan for sale buy imuran 50mg pills
When I initially commented I seem to have clicked the -Notify me when new comments are added- checkbox and now whenever a comment is added I get 4 emails with the exact same comment. Perhaps there is a way you are able to remove me from that service? Thank you.
Here is my homepage Daycares popular listings
Greetings! Very helpful advice within this article! It is the little changes that produce the biggest changes. Many thanks for sharing!
Профессиональный сервисный центр по ремонту варочных панелей и индукционных плит.
Мы предлагаем: варочная панель ремонт
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
prawo jazdy kat c+e koszt calkowity
Профессиональный сервисный центр по ремонту бытовой техники с выездом на дом.
Мы предлагаем:сервисные центры в екатеринбурге
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
цены на ремонт объективов в москве
https://considerate-dinosaur-dc4vl3.mystrikingly.com/blog/fb397273f2e
This website truly has all of the info I needed concerning this subject and didn’t know who to ask.
Very good article! We are linking to this particularly great article on our site. Keep up the great writing.
Very good article. I’m dealing with some of these issues as well..
I am curious to find out what blog system you happen to be working with? I’m having some small security issues with my latest blog and I would like to find something more safe. Do you have any recommendations?
This is a topic which is close to my heart… Cheers! Where are your contact details though?
There is definately a lot to find out about this subject. I like all the points you made.
Great information. Lucky me I came across your site by accident (stumbleupon). I have saved it for later!
https://xn--zy-hd0j5a097plop.mystrikingly.com/blog/e0ee9762708
Also visit my web blog; Daycare Near Me – Find The Best Daycares Near You