Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPBカップ
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

インスペクトエレメントの基本DIYユーザーのためのWordPressカスタマイザー

編集メモ: WPBeginner のパートナーリンクから手数料を得ています。手数料は編集者の意見や評価に影響を与えません。編集プロセスについて詳しく知る。

ウェブページを一時的に編集して、特定のスタイリングでどのように見えるかを確認したいと思ったことはないだろうか。

ブラウザーにすでにあるInspectやInspect Elementと呼ばれる開発者ツールを使って、テキストや色などを編集することが可能だ。

最小限のコーディング知識で、ページのHTMLとCSSスタイルを編集できます。変更は保存されないので、元のページは影響を受けません。

この投稿では、Inspectツールの基本的な使い方と、WordPressサイトでの使い方をご紹介します。

Using the inspect tool for DIY web developers

インスペクトツールとは?

Google Chrome、Firefox、Safari、Microsoft Edgeなどの最新のウェブブラウザには、ウェブ開発者がエラーをデバッグできるツールがビルトインされています。

これらのツールは、ページのHTML、CSSJavaScriptのコードと、ブラウザーがそのコードをどのように実行するかを表示します。

これらの開発者ツールは、任意のページにアクセスし、右クリックメニューから「Inspect」を選択することで開くことができる。

Opening Inspect developer tools in Google Chrome

Inspectツールを使えば、あらゆるウェブページのHTML、CSS、JavaSCriptのコードを編集し、変更内容を画面に表示することができる(この投稿の後半でその方法を紹介する)。

これらの変更は元のウェブページには影響せず、ウィンドウを閉じるかページを再読み込みすると消えます。

DIYサイトのオーナーや開発者がテストやデバッグを行うことができる。

  • CSSでスタイルを適用し、どのように見えるかを見ることができる。
  • スクリーンショットを撮る必要のあるテクニカルライターは、HTMLを編集して画面上のテキストを変更し、個人を特定できる情報を非表示にすることができる。
  • 開発者は、WordPressの一般的なエラー、404エラー、JavaScriptの問題のデバッグなどに使用できます。

私たちは、使用例のほんの表面をなぞったに過ぎない。これらの開発者ツールは信じられないほど強力で、上級ユーザーにとって非常に有用だ。

この投稿では、最も一般的に使用されているブラウザーであるGoogle Chromeのインスペクトツールを取り上げます。

Firefox、Safari、Microsoft Edgeなどの他のブラウザーには独自の開発者ツールがあり、ブラウザーのメニューからInspect要素を選択することで呼び出すことができます。

準備はいいかい?さあ、掘り下げよう。下のリンクから投稿のどのセクションにもジャンプできます。

動画チュートリアル

Subscribe to WPBeginner

動画が気に入らなかったり、もっと説明が必要な場合は、このまま読み進めてください。

インスペクトツールの起動とコードの検索

キーボードのCTRL + Shift + I(MacOSの場合はCommand + オプション + I)を押すと、検査ツールを起動できます。

ウェブページのどこかをクリックし、ブラウザーメニューから「Inspect」を選択することもできる。

Opening Inspect developer tools in Google Chrome

ブラウザーのメインメニューからもこのツールにアクセスできる。

Google Chromeの右上にある3つの点のメニューをクリックし、More tools(その他のツール) ” Developer tools(開発者ツール)までスクロールダウンします。

Launch developer tools

ブラウザーウィンドウが2つに分割されます。

一方には、表示していたページが表示されます。もう一方には、HTMLコードとCSSルールが表示されます。

Choose dock position

インスペクトのドックの位置は様々ですが、三点メニューをクリックして「ドック側」の位置を選択することで変更できます。上の画像にクリックするアイコンがあります。

HTMLソースの上にマウスを移動すると、ウェブページ上の影響を受けるエリアがハイライトされます。

また、HTMLコード内の要素をクリックすると、CSSルールが変更されることに気づくだろう。

Selected HTML highlighted in preview

また、ウェブページ上の要素にマウスポインタを合わせて右クリックし、「検査」ツールを選択することもできます。

その要素はソースコードでハイライトされる。

Inspect要素でのコードの編集とデバッグ

inspect要素ウィンドウのHTMLとCSSはどちらも編集可能です。HTMLのソースコードのどこかをダブルクリックして、好きなようにコードを編集することができます。

Edit HTML using Inspect tool

また、CSSペイン内の属性やスタイルをダブルクリックして編集することもできます。

カスタムスタイルルールを追加するには、CSSペインの上部にある+アイコンをクリックします。

Editing CSS in the inspect tool

CSSやHTMLに変更を加えると、その変更は即座にブラウザーに反映される。

これらの変更はブラウザーの一時メモリに保存され、サイトには影響しません。

重要な注意: ここで行った変更は、どこにも保存されません。Inspect要素はデバッグツールであり、サーバー上のファイルに変更を書き戻すことはありません。ページを更新すると、変更内容はすべて消えてしまいます。

変更するには、テーマにカスタマイザーを追加するか、関連するテンプレートを編集して保存したい変更を追加する必要があります。

Inspect Elementツールを使って既存のWordPressテーマの編集を始める前に、WordPressのバックアップを作成しておいてください。

サイトのエラーを簡単に見つける

InspectツールにはConsoleというエリアがあり、ページロード中に発生したエラーが表示される。

エラーをデバッグしたり、プラグイン投稿者にサポートを依頼したりする際には、エラーや警告がないかどうかをここで確認するのが便利です。

Inspect errors in Console

コンソール]タブを使用すると、いくつかの一般的な問題をトラブルシューティングできます。例えば、これらはinspectコンソールでできるほんの一部です:

  • 追加した画像が表示されない原因を探る
  • プラグインやテーマが正しく動作しない理由
  • 競合の原因となっているプラグインまたはブラウザー拡張機能

技術的なバックグラウンドを持たないユーザーでも、それを見て問題の原因を探る手がかりを見つけることができる。

例えば、もしあなたがOptinMonsterの顧客で、なぜオプトインが読み込まれないのか不思議に思っているのであれば、”あなたのページのスラッグが一致しない “という問題を簡単に見つけることができます。

Inspect Element ConsoleやSupportAllyのようなツールは、より良いカスタマーサポートを受けるために役立ちます。テクニカルサポートチームは、問題に対する詳細なフィードバックを率先して提供するカスタマイザーを高く評価しています。

モバイル(iOSまたはAndroid)でインスペクトツールを使用するには?

モバイルブラウザは、初期設定では開発者オプションをオンにしていない。メーカーは、ほとんどのモバイルユーザーはそれを使わないと想定している。

モバイルの問題をトラブルシューティングし、検査ツールを使用する最も簡単な方法。デスクトップのブラウザーでモバイルエミュレーション機能を使用することです。

Using inspect tool in mobile mode

次に、端末を上部または画面サイズから選択できます。Chromeがその画面サイズをエミュレートします。

よくある質問

以下は、インスペクトツールの使用に関して、ユーザーからよく寄せられる質問です。

1.インスペクトツールはどのサイトでも使えますか?

はい、どのサイトでも検査ツールを使うことができます。右クリックしてブラウザーメニューからインスペクトツールを選択するだけで、どんなサイトでもコードを見ることができます。他のサイトのコードを研究することは、あなた自身のCSS/HTMLスキルを学び、向上させる手っ取り早い方法です。

2.ブラウザーでインスペクトツールが見つからないのですが?

特に複数の拡張機能が右クリックメニューに独自のオプションを追加した場合、Google Chromeは右クリックメニューの[検査]オプションを非表示にすることがあります。しかし、ブラウザー画面の右上にある3つの点のメニューをクリックし、その他のツール ” 開発者ツールを選択すれば、いつでもインスペクトツールを開くことができます。また、キーボードのCTRL + Shift + I(MacではCommand + Options + I)キーでも開くことができます。

ボーナス・リソース

DIYでWordPress初心者のサイトに変更を加えられるのはエキサイティングだ。

長年にわたり、サイト構築の経験ゼロの初心者がその道のプロになるのを数え切れないほど見てきました。

インスペクトツールを使ってWordPressサイトでできることをさらに調べたい場合は、以下のリソースを参考にしてください。

この投稿が、Inspect要素の基本的な使い方とWordPressサイトでの使い方を学ぶ一助となれば幸いです。また、WordPressの初期設定で生成されるCSSチートシートも参考にして、テーマ開発スキルを高めてください。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

21件のコメント返信を残す

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Mrteesurez says

    This is helpful, I don’t know one can actually edit the code and see changes in real time.
    My question:
    1) Can I use the inspection tool to see the PHP or anynbackend code ??
    2) Is there anyway I can use the inspection tool on mobile ??

    • WPBeginner Support says

      You would not use the inspection tool to see PHP it is normally used to check HTML, CSS, and JavaScript. For mobile it is not available by default but there are apps to add the ability to mobile.

      管理者

  3. Jiří Vaněk says

    Thanks for this guide. Now is much more easier for me to find CSS class in code for making any changes. The CSS code can make AI for me, becouse Im not good at coding, and rest Im able to find in isnpect tools. That is all what I need.

  4. hossam ismail says

    hey!
    I can’t change my heading font size in mobile version.
    For example,
    Heading font size in desktop is 24px
    but it is also 24px in mobile ??
    this issue especially with heading, how can i fix this?

    • WPBeginner Support says

      If you reach out to your theme’s support they should be able to let you know how they have set up the mobile CSS

      管理者

    • WPBeginner Support says

      It would depend on what was edited, if is CSS then you would add the CSS under Appeaance>Customize>Additional CSS. If it is more of an HTML change then you would want to check with your theme’s support as WordPress themes are built with templates, for a bit more on that you would want to take a look at our glossary page here: https://www.wpbeginner.com/glossary/template/

      管理者

  5. Milan says

    Once I make changes, how I can save update/edited page? Whenever I close it it revert to previous version.

    • WPBeginner Support says

      Inspect element is for testing the changes, if you’re editing the CSS you would want to copy the CSS you added and paste it under Appearance>Custmize>Additional CSS :)

      管理者

  6. Kristina says

    My dilemma is that once I inspect an element, I’d like to know what PAGE in my theme this element appears on. So there’s an e lement that appears as part of my theme, throughout my site, and when I inspect element, i can see the code, but can’t determine what portion of the theme has it, so that I can change it in the child theme, permanently. I tried editing one page, directly from the inspect element pane, but as soon as I exited and returned, my change was gone and it was “back to normal.”

    Anyway to inspect to element and determine where I can find it in my theme files?

    Thank you.

    • WPBeginner Support says

      Hi Kristina,

      You can try to guessing the template file based on where the code appears in the page layout. For example, if it is in header section then you may look for it in the header.php file. You can also download all your theme files via FTP and then use a tool that allows you to search for text in multiple files at once. One such app is Notepad++ (for Windows), open the app and the go to Search > Search in Files.

      管理者

  7. stephanie says

    This is such great content, thanks a lot for sharing.

    Little problem for me, nothing happens when i click ‘inspect element’ in my chrome browser. Any help or suggestions?

  8. avinash says

    Sir,
    Actually i am new in wordpress can you tell where from i can edit the Html elememt and where i
    can found the element.style in wordpress theme.

  9. Isaac Anim says

    This is a very great post you have here. But I need to draw your attention to something.

    I don’t know if you have noticed but this particular article has being stolen. It looks like the culprit only goes around the web stealing content. As I write this comment, he has copied about 5 of my articles.

    The website is even not in Google Search. I was just checking how my website looks in Yandex search results and I happen to find this thief.

    Here is the link to the stolen article

  10. Sila Mahamud says

    Customizing WordPress for DIY Users and you have also highlighted What is Inspect Element or Developer Tools? You also given us the video tutorial the basic of inspect elements. To be honest that is great content wherever you share with us. Thanks a lot for sharing this content with us.

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。