The CSS Shapes Editor extension for Edge Code and Brackets allows you to edit CSS Shapes values in Live Preview mode. A visual editor is stacked on top of the focused element so you can drag points and handles to change the element’s shape. This makes it very easy to see the shape changes in context. The extension is compatible with Edge Code Preview 8 and above.
What are CSS Shapes?
CSS Shapes represent a new feature, which allows web designers to wrap content inside and around custom paths. This feature opens up a lot of creative layout options because it lets designers break free from creating within the constraints of the block — the current rectangular shape of almost everything on the web.
Work on CSS Shapes is still in progress, but you can enable the feature today in Google Chrome.
Why edit CSS Shapes in the browser?
CSS Shapes are meant to be used in the browser. It makes little sense to use a classic design authoring tool to create them, then export them to CSS, then import them in a code editor, refresh the page in the browser, inspect, sigh, rinse and repeat. Any tweaks become too painful to do.
Authoring CSS Shapes in an external editor makes the workflow too difficult. It’s not easy to see how the shape interacts with the content on the web page, so there’s a lot of back-and-forth.
Installing the CSS Shapes Editor extension for Edge Code
Open File > Extension Manager and click “Install from URL”, then paste in the extension’s install URL: http://adobe.com/go/edgecode_css_shapes_editor
Turning on support for CSS Shapes in Edge Code
CSS Shapes are still under development in Google Chrome. You need to manually enable the feature before you can use the visual editor for shapes.
First, ensure that you have Google Chrome version 34 or above. Check this in Chrome’s settings menu under “About Google Chrome”. You also need to make sure that support for CSS Shapes is turned on in the Chrome instance that Edge Code uses for the Live Preview mode.
Here’s what you need to do: open any HTML file in Edge Code and launch Live Preview, then follow the instructions to enable CSS Shapes in that browser window. You only need to do this once.
This step is important!
Edge Code uses a Chrome instance separate from the main one on your computer. This means that settings will not be inherited from your main Chrome browser, if that is your day-to-day browser. Even if you have already enabled CSS Shapes in your main browser, you still need to do it again in Edge Code’s Chrome instance for LivePreview.
Using the CSS Shapes Editor
The CSS Shapes Editor in Edge Code turns on automatically when you need it. While editing a CSS shape property, such as `shape-inside` or `shape-outside`, simply focus the cursor on the property value, like `polygon(…)` or `circle(…)`, then turn on the Live Preview mode. A visual editor with draggable points and handles appears on top of the element that is being edited. If no editor appears, make sure that CSS Shapes are enabled in Google Chrome.
The in-browser editor is specialized for the shape type. Polygons get an editor where you can drag the points for the polygon vertices to change the shape. Click on the polygon outline to add new points, or double click an existing point to remove it. While editing a polygon, press the T key on your keyboard to toggle controls that scale, move and rotate the polygon shape. Circles, ellipses and rectangles get an overlay of the shape, which can be scaled and moved around.
Any changes to the shape are instantly visible in the context of the page. All actions in the shape editor reflect back to the code editor. When you are done, just turn off the Live Preview mode.
CSS Shapes can be defined with all sorts of CSS units, such as pixels, ems, rems and even percentages for responsive shapes. The CSS Shapes Editor takes care to preserve the unit type for the shape while editing.
What will you build?
Authoring CSS Shapes in the context of the browser is just one way we are making it easier to explore new web platform features. While CSS Shapes are still in development, this editor in Edge Code helps you learn about the feature today, experiment, and get ready to use shapes when they will be switched on by default.
If you need a head start, Sara Soueidan has written a great introduction to working with CSS Shapes where she describes in detail how to use the new properties.
We’re eager to see what ideas you bring to life with CSS Shapes now that there is a practical way to create, edit and tweak the shape of content on the web.
Cheers to a less rectangular web!