<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ 开发者工具 - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ freeCodeCamp 是一个免费学习编程的开发者社区，涵盖 Python、HTML、CSS、React、Vue、BootStrap、JSON 教程等，还有活跃的技术论坛和丰富的社区活动，在你学习编程和找工作时为你提供建议和帮助。 ]]>
        </description>
        <link>https://www.freecodecamp.org/chinese/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ 开发者工具 - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/chinese/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 06 Jun 2026 19:41:59 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/chinese/news/tag/developer-tools/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ 如何检查元素——Chrome 快捷方式 ]]>
                </title>
                <description>
                    <![CDATA[ 原文：How to Inspect an Element – Chrome Shortcut [https://www.freecodecamp.org/news/how-to-inspect-an-element-chrome-shortcut/] ，作者：Kolade Chris [https://www.freecodecamp.org/news/author/kolade/] 谷歌浏览器的检查功能是一个强大而易用的工具。 它是 Chrome 开发者工具的一个重要组成部分，你可以用它来检查任何网站的源代码。 但不只是这样。你可以通过改变构成网站的元素和样式——也就是网站的 HTML、CSS 和 JavaScript代码——来进一步开展工作。这就是为什么很多开发人员使用 Inspect 工具进行调试的原因。 如果你是网站开发的初学者，Inspect 工具是一个有用的功能，你可以利用它来了解网站是如何建立的、使用的字体/图标/插件，甚至是谁制作的网站。 好消息是，你不需要是网站的开发者就可以使用这个强大的工具，因为用户也可以使用它。你甚至根本不需要是一个开发者就可以使用它。 ]]>
                </description>
                <link>https://www.freecodecamp.org/chinese/news/how-to-inspect-an-element-chrome-shortcut/</link>
                <guid isPermaLink="false">626f9f03395ec5063718b118</guid>
                
                    <category>
                        <![CDATA[ 开发者工具 ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Miya Liu ]]>
                </dc:creator>
                <pubDate>Mon, 25 Apr 2022 09:20:00 +0000</pubDate>
                <media:content url="https://chinese.freecodecamp.org/news/content/images/2022/05/inspect-element.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>原文：<a href="https://www.freecodecamp.org/news/how-to-inspect-an-element-chrome-shortcut/">How to Inspect an Element – Chrome Shortcut</a>，作者：<a href="https://www.freecodecamp.org/news/author/kolade/">Kolade Chris</a></p><p>谷歌浏览器的检查功能是一个强大而易用的工具。</p><p>它是 Chrome 开发者工具的一个重要组成部分，你可以用它来检查任何网站的源代码。</p><p>但不只是这样。你可以通过改变构成网站的元素和样式——也就是网站的 HTML、CSS 和 JavaScript代码——来进一步开展工作。这就是为什么很多开发人员使用 Inspect 工具进行调试的原因。</p><p>如果你是网站开发的初学者，Inspect 工具是一个有用的功能，你可以利用它来了解网站是如何建立的、使用的字体/图标/插件，甚至是谁制作的网站。</p><p>好消息是，你不需要是网站的开发者就可以使用这个强大的工具，因为用户也可以使用它。你甚至根本不需要是一个开发者就可以使用它。</p><p>在本文中，你将学习如何打开 Chrome 浏览器的开发者工具，以便获得检查功能，以及如何检查网站上的特定元素。我还将向你展示如何通过改变文本和样式来操作网站的元素。</p><p>我将使用 freeCodeCamp.org 向你展示检查工具的工作原理。</p><h2 id="-chrome-">如何打开 Chrome 开发者工具</h2><p>要打开 Chrome 开发者工具，请点击浏览器右上角的垂直圆点。</p><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/ss1-3.png" class="kg-image" alt="ss1-3" width="600" height="400" loading="lazy"></figure><p>然后将鼠标悬停在“更多工具”上并选择“开发者工具”：</p><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/ss2-5.png" class="kg-image" alt="ss2-5" width="600" height="400" loading="lazy"></figure><p>然后你就可以进入开发者工具的标签，如 Elements（构成网站的 HTML 和 CSS）、Console（你可以用它来运行 JavaScript）、Sources 等等。</p><p>你可以拖动这些标签，把它们放在你想要的地方。</p><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/drag.gif" class="kg-image" alt="drag" width="600" height="400" loading="lazy"></figure><h2 id="-chrome--1">如何用键盘打开 Chrome 中的检查工具？</h2><p>你可以在 Linux 上按 <code>CTRL</code> + <code>SHIFT</code> + <code>C</code> 或在 Windows 上按<code>F12</code> 来打开检查工具。</p><p>如果你是使用 Mac，按 <code>Command</code> + <code>SHIFT</code> + <code>C</code>。</p><h3 id="-">如何检查网站上的特定元素</h3><p>要检查你在网站上看到的任何元素，无论是文本、按钮、视频还是图像，都可以在该元素上点击右键并点击“检查”。</p><p>在这种情况下，我将右键单击 freeCodeCamp.org 登陆页面上的 “Learn to code - for free” 文本。</p><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/ss3-3.png" class="kg-image" alt="ss3-3" width="600" height="400" loading="lazy"></figure><p>源代码将被打开，该元素将高亮显示，像这样：</p><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/ss4-2.png" class="kg-image" alt="ss4-2" width="600" height="400" loading="lazy"></figure><p>你可以看到这个文本是一个 <code>h1</code> 元素。</p><h2 id="--1">如何用检查工具操作网站的元素</h2><p>你可以用检查工具改变网站的文本内容。</p><p>例如，我将把 freeCodeCamp.org 登陆页面上的 “Build projects” 文本改为 “Build real-world projects”。</p><p>要做到这一点，在你想改变的元素上点击右键，然后点击“检查”。在这种情况下，它是 “Build projects” 文本。</p><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/ss5-2.png" class="kg-image" alt="ss5-2" width="600" height="400" loading="lazy"></figure><p>双击 “Build projects” 文本：</p><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/ss6-2.png" class="kg-image" alt="ss6-2" width="600" height="400" loading="lazy"></figure><p>输入 “Build real-world projects” 并点击 <code>ENTER</code>：</p><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/ss7-1.png" class="kg-image" alt="ss7-1" width="600" height="400" loading="lazy"></figure><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/ss8-1.png" class="kg-image" alt="ss8-1" width="600" height="400" loading="lazy"></figure><p>你可以看到文本已被改为 “Build real-world projects”。</p><h2 id="--2">如何用检查工具改变样式</h2><p>让我们把 “Get started (it’s free)” 按钮的背景改为我最喜欢的颜色 – #2ecc71。</p><p>右键单击该按钮，选择“检查”。</p><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/ss9-1.png" class="kg-image" alt="ss9-1" width="600" height="400" loading="lazy"></figure><p>双击右侧的 “background-image” 属性值，即 <code>linear-gradient(#fecc4c,#ffac33)</code>。</p><p>将颜色改为 <code>#2ecc71,#2ecc72</code> 并点击 <code>ENTER</code>。</p><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/ss10-1.png" class="kg-image" alt="ss10-1" width="600" height="400" loading="lazy"></figure><p>你可以看到按钮的背景已经改变。</p><p>我们现在在 freeCodeCamp.org 登陆页面上做了 2 个改变——我们把 “Build projects” &nbsp;文本改为 “Build real-world projects”，并且我们改变了 “Get Started (it’s free)” 按钮的背景。</p><figure class="kg-card kg-image-card"><img src="https://www.freecodecamp.org/news/content/images/2022/04/ss11-1.png" class="kg-image" alt="ss11-1" width="600" height="400" loading="lazy"></figure><h2 id="--3">你用检查工具所做的改变是永久性的吗？</h2><p>不，你用检查工具所做的任何改变都不是永久性的。一旦你重新加载页面，这些变化就会消失。</p><p>这是因为网站已经被部署到一个服务器上。因此，当你通过重新加载页面向该服务器发出另一个请求时，服务器上的内容会被你的浏览器加载。</p><p>所以不要担心——你以这种方式尝试使用检查工具不会永久地改变一个网站。它只是帮助你学习更多的知识和练习编码 :)</p><h2 id="--4"><strong>总结</strong></h2><p>这篇文章向你展示了如何进入谷歌浏览器的开发者工具、如何使用其检查功能来查看网站的源代码，以及如何用它来改变网站的元素和样式。</p><p>如果你刚开始学习 HTML、CSS 和 JavaScript 代码，Chrome 开发者工具的检查功能是一个强大的工具，你可以用它来查看任何网站的源代码，这样你就可以了解它们是如何构建的。</p><p>谢谢你阅读本文。</p> ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
