この記事の例では、参考のためにマルチレベルのドロップダウン水平ナビゲーション メニュー コードの純粋な CSS 実装を共有しています。具体的な内容は次のとおりです
まずレンダリングを見てみましょう:
実装コード:
CSS コード:
<style type="text/css"> /* for this demo only */ #backgroundHolder { width:750px; height:500px; padding-top:10px; margin:0 auto; } /* ---------------------------------------------------------------------------- */ /* default styling */ .nav, .nav ul { list-style-type:none; margin:0; padding:0; } .nav a { text-decoration:none; } .nav { font-family: arial, sans-serif; font-size:12px; width:650px; margin:0 auto; } /* style the links */ .nav a { background:url(ulmulti3/box.gif) no-repeat rightright center; } .nav a.top { background:url(ulmulti3/box.gif) no-repeat rightright top; } .nav a.top2 { background:url(ulmulti3/box2.gif) no-repeat rightright top; } .nav a.bottombottom { background:url(ulmulti3/box.gif) no-repeat rightright bottombottom; } .rightright ul ul a { background:url(ulmulti3/box3.gif) no-repeat rightright center; } .rightright ul ul a.top2 { background:url(ulmulti3/box3.gif) no-repeat rightright top; } .rightright ul ul a.bottombottom { background:url(ulmulti3/box3.gif) no-repeat rightright bottombottom; } /* style the <b> element so that is does not affect the size of the link */ .nav a b { color:#fff; font-weight:normal; display:block; padding:5px 10px 5px 15px; } .nav .fly .main b { background: transparent url(ulmulti3/arrow.gif) no-repeat 117px 9px; } .nav .down b { background: transparent url(ulmulti3/arrow2.gif) no-repeat 115px 11px; } .nav .rightright ul b { text-align:rightright; } .nav .rightright ul ul b { padding: 5px 15px 5px 10px; } .nav .rightright ul .main b { background: transparent url(ulmulti3/arrow3.gif) no-repeat 15px 9px; text-align:rightright; } .nav .rightright ul ul .main b { background: transparent url(ulmulti3/arrow3.gif) no-repeat 5px 9px; text-align:rightright; } /* HEIGHT */ .nav ul ul { top:-24px; } /* position the top of the flyout first sub menus */ .nav ul ul ul { top:-25px; } /* position the top of the flyout second and third sub menus */ .nav ul.two { top:-40px; } /* position the top of the flyout sub menus with previous text on two lines */ /* WIDTH change this WITH CARE to suit your requirements */ /*set the link width here*/ .nav .drop, .nav a { width:130px; } .nav ul li { max-width:130px; } /* fix for IE8 */ /* set the left flyout position here */ .nav ul ul { left:130px; } /* set the right flyout position here */ .nav li.rightright ul ul { left:auto; rightright:120px; } .nav li.rightright ul ul ul { left:auto; rightright:130px; } /* make this WIDTH - 1px */ /* or WIDTH - 0.063em if using em sizing */ .nav a { margin-right:-129px; } /* ---------------------------------------------------------------------------- */ /* DO NOT CHANGE ANYTHING BELOW */ .nav li { float:left; } /* fixes IE bugs, and allows for clearing */ .nav ul { float:left; position:relative; z-index:20; } /* necessary for float drop and to stack the <ul>s */ .nav ul li { clear:left; } /* must clear the floated list item inside sublist */ .nav a { position:relative; display:block; } /* needs to have a position, to be above the rest */ .nav a.main { float:left; /* necessary for float drop */ margin-top:10000px; } /* bring the top level links back into view */ .nav .drop, .nav .fly { margin-top:-10000px; } /* hide the sub links and their containers, opera has low upper limits */ .nav ul { margin-bottom:-5000px; } /* avoid any interaction between the subs, can be any large size */ /* The bit that does ALL the work to bring the sub menus into view */ .nav a:hover, .nav a:focus, .nav a:active { margin-right:0; z-index:10; outline:0; } .nav a:hover b, .nav a:focus b, .nav a:active b { color:#000; cursor:pointer; } /* this is for keyboard tabbing color change */ /* OPERA fix */ .nav ul:hover, .nav ul ul:hover { clear:left; } /* to stop intermittent sub link :hover problems */ /* ---------------------------------------------------------------------------- */ </style> <!--[if lte IE 7]> <style type="text/css"> /* bug fixes for IE7 and lower - DO NOT CHANGE */ .nav .fly {width:99%;} /* make each flyout 99% of the prevous level */ a:active {} /* requires a blank style for :active to stop it being buggy */ </style>
html コード: reee
以上がこの記事の全内容です、私は皆さんの学習に役立つことを願っています。また、皆さんが PHP 中国語 Web サイトをたくさんサポートしてくれることを願っています。以上が最も美しい CSS マルチレベルのドロップダウン水平ナビゲーション メニューのコード共有を作成するの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

先日、この質問がありました。私の最初の考えは、奇妙な質問です!特異性はセレクターに関するものであり、アットレールはセレクターではないので、...無関係ですか?

はい、あなたはできます、そしてそれは本当にどの順序で重要ではありません。 CSSプリプロセッサは必要ありません。通常のCSSで動作します。

CSSやJavaScript(および画像とフォントなど)などのアセットにファーアウトキャッシュヘッダーを確実に設定する必要があります。それはブラウザを伝えます

多くの開発者は、CSSコードベースを維持する方法について書いていますが、そのコードベースの品質をどのように測定するかについて多くの人が書いていません。確かに、私たちは持っています

短い任意のテキストを受け入れるために必要なフォームを持っていたことがありますか?名前などのように。それはまさにそのためのものです。たくさんあります

私は、フロント会議のためにスイスのチューリッヒに向かうことにとても興奮しています(その名前とURLが大好きです!)。私はこれまでスイスに行ったことがないので、興奮しています

ソフトウェア開発における私のお気に入りの開発の1つは、サーバーレスの出現です。詳細に行き詰まる傾向がある開発者として

この投稿では、私が構築して展開して展開してネットライフを使用して、着信データの動的ルートを作成する方法を示すeコマースストアのデモを使用します。それはかなりです


ホットAIツール

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

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

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

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

人気の記事

ホットツール

MinGW - Minimalist GNU for Windows
このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

PhpStorm Mac バージョン
最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール

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

Safe Exam Browser
Safe Exam Browser は、オンライン試験を安全に受験するための安全なブラウザ環境です。このソフトウェアは、あらゆるコンピュータを安全なワークステーションに変えます。あらゆるユーティリティへのアクセスを制御し、学生が無許可のリソースを使用するのを防ぎます。

VSCode Windows 64 ビットのダウンロード
Microsoft によって発売された無料で強力な IDE エディター
