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

🔐 Why Microsoft Replacing Passwords Is a Good Thing — Linux Mint vs. Ubuntu

Thursday, December 26, 2024

Also: How I Used QR Codes and Google Sheets to Organize My Home How-To Geek Logo December 26, 2024 Did You Know A "moment" used to be an actual measure of time, corresponding to roughly 90

Ranked | The World's 10 Largest Companies by Revenue (2019-2024) 💰

Thursday, December 26, 2024

We show the world's largest companies by revenue, based on the Fortune Global 500 rankings as stock markets rally in 2024. View Online | Subscribe | Download Our App FEATURED STORY The World's

Issue 345 - OTA software updates are amazing

Thursday, December 26, 2024

View this email in your browser If you are just now finding out about Tesletter, you can subscribe here! If you already know Tesletter and want to support us, check out our Patreon page Issue 345 - OTA

Do Honeypots Still Matter?

Thursday, December 26, 2024

Top Tech Content sent at Noon! Boost Your Article on HackerNoon for $159.99! Read this email in your browser How are you, @newsletterest1? 🪐 What's happening in tech today, December 26, 2024? The

Best Practices for Composition Patterns in Jetpack Compose

Thursday, December 26, 2024

View in browser 🔖 Articles Best Practices for Composition Patterns in Jetpack Compose Jetpack Compose is a newly introduced declarative UI framework compared to other declarative UIs, and there hasn

wpmail.me issue#699

Thursday, December 26, 2024

wpMail.me wpmail.me issue#699 - The weekly WordPress newsletter. No spam, no nonsense. - December 26, 2024 Is this email not displaying correctly? View it in your browser. News & Articles 12 Best

Post from Syncfusion Blogs on 12/26/2024

Thursday, December 26, 2024

New blogs from Syncfusion Create a Flutter 3D Column Chart to Showcase the Top 6 Renewable Energy-Consuming Countries By Praveen Balu Let's visualize the top 6 renewable energy-consuming countries

Ruijie Networks' Cloud Platform Flaws Could Expose 50,000 Devices to Remote Attacks

Thursday, December 26, 2024

THN Daily Updates Newsletter cover Improve IT Efficiency with a Standardized OS: Nine considerations for building a standardized operating environment Optimize your IT with a standardized operating

Edge 460: Anthropic's New Protocol to Link AI Assistants to Data Sources

Thursday, December 26, 2024

Model Context Protocols is one of the recent AI contributions of the AI lab. ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

December 26th 2024

Thursday, December 26, 2024

Curated news all about PHP. Here's the latest edition Is this email not displaying correctly? View it in your browser. PHP Weekly 26th December 2024 Hi everyone, It's boxing day in some parts