Giter Club home page Giter Club logo

css_plus_html's Introduction

CSS+HTML

Chrome/Chromium extension that allows you to capture the page author or computed styles of the current inspected element along with the markup for the element and its children.

Screenshot

Installation

You may install this extension from its Google Chrome Webstore Page or download the source from Github and manually load as an "Unpacked extension" via Chrome's extensions page. Tick the "Developer Mode" checkbox on the extensions page to allow loading unpacked extensions.

Usage

  1. Inspect an element within a web page by:
    • Right-clicking on the element and selecting "Inspect Element".
    • OR open Chrome Developer Tools from the menu Tools > Developer Tools or by pressing F12. Then click the magnifying glass icon at the bottom. Now move the mouse pointer over the desired element in the web page and click to inspect it.
  2. After an element is inspected, options to capture the styles and markup will be displayed in the right panel of the "Elements" tab under "CSS+HTML" (please see the screenshot).
  3. Choose an output option:
    • Click "Author Styles" to capture:
      • CSS rules from external and embedded stylesheets that apply to the inspected element.
      • CSS rules from external and embedded stylesheets that apply to the inspected element's children.
      • HTML markup, including inline styles set via the "style" attribute, for the inspected element.
      • HTML markup, including inline styles set via the "style" attribute, for the inspected element's children.
      • Inheritable styles from parent elements. A mocked parent element is created with inheritable properties set on it.
    • Click "Author Styles (matching selectors only)" to capture:
      • Same as "Author Styles".
      • Selectors that do not match the inspected element or its children will be removed.
    • Click "Author Styles (inspected element only)" to capture:
      • CSS rules from external and embedded stylesheets that apply to the inspected element only.
      • HTML markup, including inline styles set via the "style" attribute, for the inspected element.
      • HTML markup, including inline styles set via the "style" attribute, for the inspected element's children.
      • Inheritable styles from parent elements. A mocked parent element is created with inheritable properties set on it.
    • Click "Author Styles (inspected element only, matching selectors only)" to capture:
      • Same as "Author Styles (inspected element only)".
      • Selectors that do not match the inspected element will be removed.
    • Click "Computed Styles" to capture:
      • This method attempts to capture all document author styles, including inherited author styles, for the inspected element and its children by calling getComputedStyle for each element. An attempt is made to include only document author styles and omit default and user agent styles.
    • Click "All Styles" to capture:
      • This method attempts to capture all styles for the inspected element and its children by calling getComputedStyle for each element. This option tends to be slow, overly aggressive at retrieving styles, inaccurate at times, and produces a ton of output. :(
  4. The results will automatically be selected and focused for copying. Press CTRL-C or right click the output and choose copy.
  5. If you inspect a different element while an output option is open, the output will be updated for the new element.

Disclaimers

  • The extension uses Yahoo's YQL service to gain access to stylesheets that are restricted by Cross-Origin-Request security. This can adversely affect the performance of web pages.
  • Author Styles results contain selectors that matched the inspected element and its children within the inspected page. Once the CSS rules are extracted into the Author Styles results panel, the selectors may no longer match due to parent elements that do not exist in the resulting document fragment.
  • The Computed and All Styles sections are prone to error and sometime capture too much information while missing a few items. Performance is also very poor.

Bugs and Features

If you found a bug or have a feature request, please create an issue here on GitHub.

Future Plans

  • Create a "Computed Author Styles" section that gathers the author styles for the inspected element and its children along with inherited styles. The styles will be output as inline styles instead of CSS rulesets. This should produce a much improved version of getComputedStyles that is more intuitive and useful.
  • Refactor and clean up code. Increase code reuse.

Changelog

  • v0.44: improved performance and minimized the number of inherited styles returned
  • v0.43: fixed support for local files
  • v0.42: fixed jquery conflict that would cause pages to malfunction
  • v0.41: added support for inherited styles to author styles

Thanks to

Author

Corey Meredith

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

css_plus_html's People

Contributors

ataridhd avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.