CSS3でレスポンシブレイアウトを作る方法
今日は、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 サイトの他の関連記事を参照してください。

ホットAIツール

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

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

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

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

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック









vue.jsでBootstrapを使用すると、5つのステップに分かれています。ブートストラップをインストールします。 main.jsにブートストラップをインポートしますブートストラップコンポーネントをテンプレートで直接使用します。オプション:カスタムスタイル。オプション:プラグインを使用します。

HTMLはWeb構造を定義し、CSSはスタイルとレイアウトを担当し、JavaScriptは動的な相互作用を提供します。 3人はWeb開発で職務を遂行し、共同でカラフルなWebサイトを構築します。

ブートストラップスプリットラインを作成するには2つの方法があります。タグを使用して、水平方向のスプリットラインを作成します。 CSS Borderプロパティを使用して、カスタムスタイルのスプリットラインを作成します。

webdevelopmentReliesOnhtml、css、andjavascript:1)htmlStructuresContent、2)cssStylesit、および3)Javascriptaddsinteractivity、形成、

Bootstrapフレームワークをセットアップするには、次の手順に従う必要があります。1。CDNを介してブートストラップファイルを参照してください。 2。独自のサーバーでファイルをダウンロードしてホストします。 3。HTMLにブートストラップファイルを含めます。 4.必要に応じてSASS/LESSをコンパイルします。 5。カスタムファイルをインポートします(オプション)。セットアップが完了したら、Bootstrapのグリッドシステム、コンポーネント、スタイルを使用して、レスポンシブWebサイトとアプリケーションを作成できます。

ブートストラップに画像を挿入する方法はいくつかあります。HTMLIMGタグを使用して、画像を直接挿入します。ブートストラップ画像コンポーネントを使用すると、レスポンシブ画像とより多くのスタイルを提供できます。画像サイズを設定し、IMG-Fluidクラスを使用して画像を適応可能にします。 IMGボーダークラスを使用して、境界線を設定します。丸い角を設定し、IMGラウンドクラスを使用します。影を設定し、影のクラスを使用します。 CSSスタイルを使用して、画像をサイズ変更して配置します。背景画像を使用して、背景イメージCSSプロパティを使用します。

ブートストラップボタンの使用方法は?ブートストラップCSSを導入してボタン要素を作成し、ブートストラップボタンクラスを追加してボタンテキストを追加します
