Can I tweak a page's appearance using Google Chrome's developer tools? - css

When I'm working on a web page layout, I often use Firefox and Firebug to tweak the CSS until it looks right, then modify my style sheet to match.
Right now, I'm trying to fix something that looks fine in other browsers but wrong in Google Chrome. I have pulled up Chrome's Developer Tools, and can inspect the computed style, but don't see a way to edit values and see the results on my page.
Is there a way to do this?

Yes. For CSS, for example, you double click on the property in the right pane. For HTML, right click on an element and select "Edit as HTML".

Related

How can I view the default css styles for -webkit-scrollbar and -webkit-scrollbar-track etc?

I'm trying to see what default css values (possibly source code?) are for webkit psuedoelements so that I can create custom webkit items that are very similar to the default, but slightly customized.
These items are shadow elements that don't show up in the DOM. you can enable 'Show user agent shadow DOM' in chrome devtools settings, per
Inspect webkit-input-placeholder with developer tools, but i'm still not seeing elements in the DOM. I suspect the styles are being provided by user agent stylesheet for these webkit items
Load a page utilizing the CSS in question with your browser, then you can use developer features to inspect it.
Right-click the page
In Chrome, the menu choice is 'Inspect'
The screen will split, the page source appears on the bottom of your screen (not sure what happens if browsing on a phone)
On the bottom of the screen, you will see the html, on the bottom right you will see the pertinent CSS you select some html on the right.
Note there is a link to the style sheet on the far right, click to view
Unfortunately, the link is hard to read because all spaces and linefeeds have been removed, but you can paste it into an editor and make it easier to read

Best way to figure out what css is being applied to an element

I started building a site using a bootstrap template, but I'm having a hard time figuring out how to tweak the css. For example, a table might stretch across the entire page. But when I use F12 to look at the css, I don't see anything related to a width property anywhere around the table. Is there a better way to determine what css is being applied or inherited?
You can use the Google Chrome element inspector. Right click on a div or any other page element, and then click "Inspect Element". From there you can view the CSS that is being applied to a specific element.
Check out this Chrome plugin called SnappySnippet. (Also, prepare to be amazed)
Have a look inside bootstrap.css file , there should be plenty of code and not every element has it's own separate css , some elements are defined together
If you use google dev tools (F12), the navigation tab will let you click on "Resources." When you click that, you can look at the scripts, stylesheets, see a list of images used, etc...
if you click the "magnifying glass" in Google dev tools (F12), you can hover over any element on the page. Click that element and on the right side, the CSS will be displayed. Usually the stylesheet is called out inside the css.

How to filter and show only applied CSS in Chrome Developer Tools (like Firebug in Firefox)

Background story: I have a page with multiple CSS that override each other. There are so many crossed out CSS style, so I don't want to see them.
I know Firebug on Firefox provide this feature (Only Show Applied CSS), which can show what CSS style in what CSS file is being applied (neat !).
How do we have this feature on Chrome ? I tried install Firebug Lite for Chrome but no luck.
PS: Chrome have Computed Style tab, but it does not show what style come from what CSS file.
In the Chrome dev tools, in the right hand column (where CSS is shown in the Elements panel), the first section is called "Computed Style". If you deselect "show inherited", you get a neat list of the styles that actually apply to the element. Does that help?

Is there a browser extension to get all the CSS that is applied to a DOM element?

Firebug is great, and allows me to see all the CSS applied to an element in the DOM that you select, but either you can:
a) View it line by line, as defined in the CSS, in the applied order (very useful but not what I'm looking for) or
b) View it "computed", which is all CSS rules and the values that this element has.
What I want is a tool or extension that allows me to select an element and would show me, in copy-pastable form, all the CSS that's been defined for that element. If the element has font-style:normal just because it's the default for that element, I don't want that there (Firebug shows all this in computed view).
Basically I want to be able to:
I see an element I'd like to replicate on a website (like a button) exactly in my own website.
Use this tool to get a bunch of CSS applied to that element.
Paste on my own CSS.
Get the same looking element in my website. Yay!
Any ideas?
Switch to Chrome default element inspector (press F12), it has all that you need. You'll find everything in the Computed Style panel, including a useful "Show inherited" checkbox
I know the question is almost 4 years old, but if there is someone looking for it today, there's a Chrome extension that handles it. https://github.com/kdzwinel/SnappySnippet
It adds a new tab in Chrome Inspector and you just need to click a button to get all html and css of the selected element and its children. Then you can export it to codepen, jsfiddle and jsbin, or copy and paste.
Google Chrome has tools like Firebug built in called "Chrome Developer Tools". It is extremely powerful from my experience and I switched from Firefox/Firebug to Chrome about a year ago. There are several different ways to get the developer tools up. You can find detailed documentation at https://developers.google.com/chrome-developer-tools/docs/overview
When you have the Chrome developer tools open to the elements tab with an element selected, you can expand the computed styles area on the right and see all styles that make up that element.
If the specific style has an expandable triangle to its left, you can find out what stylesheet and where the styling comes from.
You don't need any extensions for that, the built-in inspector in Firefox can do that. Right-click the element, choose "Inspect Element". Click the Style button in the bottom toolbar - and there it is, a sidebar with all the styles applied to that element.
I have tried to calculate it via window.getComputedStyle and it is needed to be optimized to shake out unnecessary style properties. https://github.com/aleen42/DOM-mirror
I've tried SnappySnippet and found CSSSteal to be much better. It will grab just the CSS, and will do so in the same format as the document has it, unlike SnappySnippet.
There's an API on window Object >> window.getComputedStyle(DOMElement). This is if we need to work with computed styles programmatically.
MDN Docs for window.getComputedStyle
Good Luck...
You can try this extension https://getcssscan.com/?ref=beautifulcheckboxes_header but it is not free. I found this while I was finding a solution.

Tool to retrieve CSS properties affecting to the selected Text in a browser?

As you know in any browser you can select a 'piece' of the website and you can get the HTML code for your selection,
well,
is there any tool you can do the same and it shows you the CSS that only afects to your selection?
EDIT
I know you can get the CSS affecting a tag using Firebug, but how about getting the CSS affecting a larger selection of code?
The tool I was looking for
Dust-Me Selectors (Firefox Add-on)
https://addons.mozilla.org/firefox/addon/5392/
but it's not supported by firefox 6 i needed to downgrade.. (its in developement, dough)
Yes: http://getfirebug.com/
Use the "Inspect element" option.
Fore developing, you can use Firefox addon FireBug, and for Chrome and IE, there are developer console under F12 key, that allows you to select DOM element, and see all set properties.
With firebug in firefox you can use the inspect element tool:
use the mouse, click on any part of the page
you'll see in the right
bottom of the screen the CSS of that part of the page.
There you get all the CSS values hierarchy, even the superseded values.
Also, you can copy all, selecting and copying

Resources