Dev Tips: DevTools:️ How deactivated CSS styles works

Dev Tips

 

DevTools: How copying and pasting deactivated CSS styles works

DevTools has some small, yet handy features when it comes to dealing with styles.

If you copy some deactivated style rules, they are commented out when you paste them in, for example, in your code editor.

An example

Say you have the following in your DevTools styles pane:

.container {
    ☑ width: 100%;
    ☑ margin-left: auto;
    ☐ margin-right: auto;
    ☑ max-width: 1280px;
}

Copying the code above (from within DevTools) and then pasting it into your editor presents this:

.container {
    width: 100%;
    margin-left: auto;
    /* margin-right: auto; */
    max-width: 1280px;
}

The Sources Panel

This feature is also compatible with the Sources Panel, meaning if you comment out a CSS style in the Elements Panel, the raw source code as shown in the Sources Panel will reflect those changes.

A screenshot showing how DevTools comments out the CSS of a deactivated style

Note: In my testing, I did observe some bugs when dealing with Source Maps (e.g. Sass code).

This feature works the other way also. If you comment out a CSS style in the Sources Panel, the Style Pane in the Elements Panel reflects your changes and deactivates the corresponding styles.

A screenshot showing how DevTools reflects your changes from the Sources Panel, back to the Styles Pane in the Elements Panel

Bonus Tip

As a bonus tip, you can Command + Click (or Control + Click) on a CSS style from the Styles Pane in the Elements Panel. When you do this, you are taken straight to the Sources Panel code with the revelvant line of code highlighted.

Here's the web version of this email: umaar.com/dev-tips/232-copy-paste-deactivated-styles

Email Marketing Powered by Mailchimp

Copyright © 2020 Umar, All rights reserved.
You are receiving this email because you signed up for Dev Tips.

unsubscribe from this list    update subscription preferences 

Older messages

DevTools: Improve accessibility by emulating vision deficiencies

Friday, July 10, 2020

Dev Tips Chrome DevTools: Improve page accessibility by emulating vision deficiencies Web developer tooling to improve accessibility has improved rapidly over the years. Emulating vision deficiencies

Dev Tips: JavaScript: ⚡️ Improve the performance of your event listeners

Wednesday, July 1, 2020

Dev Tips I've been blogging more on my website, go and check it out! JavaScript: Improve the performance of your event listeners In your JavaScript code, you can automatically remove an event

Dev Tips: DevTools: Copy an element into your clipboard with this keyboard only workflow

Saturday, June 20, 2020

Dev Tips Thank you for voting for the next video course. Will update you next month! DevTools: Copy an element into your clipboard with this keyboard only workflow You can get any element into your

You Might Also Like

Weekend Reading — Objection-oriented programming

Saturday, May 18, 2024

This week we find a power-up box, replace GitHub Actions with Maven XMLs, avoid the worst website in the world, revisit RTO policies, “listen” to OpenAI employees, watch our Slack private messages, do

Daily Coding Problem: Problem #1445 [Easy]

Saturday, May 18, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Jane Street. The United States uses the imperial system of weights and measures, which

You don’t have to take our word for it…

Saturday, May 18, 2024

You can probably tell how excited we are to re-launch our Gigantic courses – which bring on-demand product management training for today's modern Product Managers and Product Leaders. In fact, we

🐍 New Python tutorials on Real Python

Saturday, May 18, 2024

Hey there, There's always something going on over at realpython.com as far as Python tutorials go. Here's what you may have missed this past week: What Is the __pycache__ Folder in Python? In

Visualized | Life Expectancy by Region (1950-2050F) 📊

Saturday, May 18, 2024

This map shows life expectancy at birth for key global regions, from 1950 to 2050F. View Online | Subscribe Presented by Voronoi: The App Where Data Tells the Story FEATURED STORY Life Expectancy by

New Wi-Fi Vulnerability Enables Network Eavesdropping via Downgrade Attacks

Saturday, May 18, 2024

THN Daily Updates Newsletter cover The DevSecOps Playbook: Deliver Continuous Security at Speed ($19.00 Value) FREE for a Limited Time A must-read guide to a new and rapidly growing field in

🐍 New Python tutorials on Real Python

Saturday, May 18, 2024

Hey there, There's always something going on over at realpython.com as far as Python tutorials go. Here's what you may have missed this past week: What Is the __pycache__ Folder in Python? In

Toward 'local' AI w/ Apple's new chip

Saturday, May 18, 2024

faster than the cloud ☁️ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

OpenAI and Google lay out their competing AI visions

Saturday, May 18, 2024

Plus: Is Mark Zuckerberg a style icon now? View this email online in your browser By Cody Corrall Saturday, May 18, 2024 Welcome back to TechCrunch's Week in Review. This week had two major events

Noonification: Dear America, I Am Breaking Up With You

Saturday, May 18, 2024

Top Tech Content sent at Noon! Get Algolia: AI Search that understands How are you, @newsletterest1? 🪐 What's happening in tech today, May 18, 2024? The HackerNoon Newsletter brings the HackerNoon