今日は、CSS3 で作成したレスポンシブ レイアウト の事例を紹介します。レスポンシブ性は、CSS3 の機能に習熟すれば、携帯電話と PC の両方に習熟できるようになります。の使用法。
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> *{padding: 0;margin: 0;} html,body{width: 100%;height: 100%;background:url(img/bj.jpg) ;background-size: 100% 100%;} #nav{width: 560px;height:40px ;margin: 10px auto;} ul,li{list-style: none;} .list{width: 560px;height: 40px;background: #fff;} .list li{width: 50px;height: 40px;margin: 0 10px;float: left; transition: all 1s; } .list li:nth-child(1){ background: url(img/1.png) top; } .list li:nth-child(2){ background: url(img/2.png) top; } .list li:nth-child(3){ background: url(img/3.png) top; } .list li:nth-child(4){ background: url(img/4.png) top; } .list li:nth-child(5){ background: url(img/5.png) top; } .list li:nth-child(6){ background: url(img/6.png) top; } .list li:nth-child(7){ background: url(img/7.png) top; } .list li:nth-child(8){ background: url(img/8.png) top; } .list li:hover{ background-position: bottom; } @media only screen and (min-width: 640px) and (max-width: 980px) { #nav{position: fixed;top:100px;left:10px;width: 50px;height:400px ;margin: 10px auto;} ul,li{list-style: none;} .list{width: 67px;height: 400px;background: #fff;} .list li{width: 50px;height: 40px;margin: 0 10px;float: left; transition: all 1s; } } @media only screen and (min-width: 100px) and (max-width: 640px) { #nav{position: fixed;top:100px;left:10px;width: 50px;height:400px ;margin: 10px auto;} ul,li{list-style: none;} .list{width: 67px;height: 400px;background: red;} /*.list li{width: 50px;height: 40px;margin: 0 10px;float: left; transition: all 1s; background: #fff; }*/ .list li:nth-child(1){ background: url(img/1.png) top; } .list li:nth-child(2){ background: url(img/2.png) top; } .list li:nth-child(3){ background: url(img/3.png) top; } .list li:nth-child(4){ background: url(img/4.png) top; } .list li:nth-child(5){ background: url(img/5.png) top; } .list li:nth-child(6){ background: url(img/6.png) top; } .list li:nth-child(7){ background: url(img/7.png) top; } .list li:nth-child(8){ background: url(img/8.png) top; } .list li:hover{ background-position: bottom; } .list li{width: 50px;height: 40px;margin: 0 10px;float: left; transition: all 1s; border-radius: 50%; } } </style> </head> <body> <div id="nav"> <ul> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </div> </body> </html>
上記はレスポンシブ レイアウトの例です。さらに興味深い情報については、php 中国語 Web サイトの他の関連記事にご注目ください。
関連書籍:
以上がCSS3でレスポンシブレイアウトを作る方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

記事では、CSSマージンプロパティ、特に「マージン:40px 100px 120px 80px」、そのアプリケーション、およびWebページレイアウトへの影響について説明します。

この記事では、カスタマイズ、ベストプラクティス、および応答性に焦点を当てたCSSボーダープロパティについて説明します。主な議論:Border-Radiusは、レスポンシブデザインに最も効果的です。

この記事では、CSSのバックグラウンドプロパティ、Webサイトの設計の強化における使用、および避けるべき一般的な間違いについて説明します。重要な焦点は、バックグラウンドサイズを使用したレスポンシブデザインです。

記事では、CSS HSLの色、Webデザインでの使用、およびRGBよりも利点について説明します。主な焦点は、直感的な色の操作を通じて設計とアクセシビリティを向上させることです。

この記事では、CSSでのコメントの使用について説明し、シングルラインとマルチラインのコメント構文を詳述しています。コメントはコードの読みやすさ、保守性、コラボレーションを強化するが、適切に管理されていないとウェブサイトのパフォーマンスに影響を与える可能性があると主張しています。

この記事では、HTML要素のスタイリングのCSSセレクター、その種類、および使用法について説明します。 IDとクラスのセレクターを比較し、複雑なセレクターでパフォーマンスの問題に対処します。

この記事では、CSSの優先順位について説明し、特異性が最も高いインラインスタイルに焦点を当てています。 CSS競合を管理するための特異性レベル、オーバーライド方法、およびデバッグツールを説明します。

記事では、CSS構文、学習戦略、一般的な間違い、検証ツールについて説明します。主な焦点は、実践と理解を通じてCSSをマスターすることです。


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Linux 新バージョン
SublimeText3 Linux 最新バージョン

DVWA
Damn Vulnerable Web App (DVWA) は、非常に脆弱な PHP/MySQL Web アプリケーションです。その主な目的は、セキュリティ専門家が法的環境でスキルとツールをテストするのに役立ち、Web 開発者が Web アプリケーションを保護するプロセスをより深く理解できるようにし、教師/生徒が教室環境で Web アプリケーションを教え/学習できるようにすることです。安全。 DVWA の目標は、シンプルでわかりやすいインターフェイスを通じて、さまざまな難易度で最も一般的な Web 脆弱性のいくつかを実践することです。このソフトウェアは、

MantisBT
Mantis は、製品の欠陥追跡を支援するために設計された、導入が簡単な Web ベースの欠陥追跡ツールです。 PHP、MySQL、Web サーバーが必要です。デモおよびホスティング サービスをチェックしてください。

AtomエディタMac版ダウンロード
最も人気のあるオープンソースエディター

ホットトピック









