Emmet - Is it possible to automatically generate the CSS structure by writing HTML code?

I have a question about html and css automation. I frequently use Emmet to write HTML code quickly. Can I write my HTML in such a way that the CSS structure will auto-generate? For example, if I write the following code:

div.container>div.header>a.logo+h1{Hello World}

Emmet will generate this output:

<div class="container">
 <div class="header">
  <a href="" class="logo"></a>
  <h1>Hello World</h1>
 </div>
</div>

But what I really want is this result:

<div class="container">
 <div class="header">
  <a href="" class="logo"></a>
  <h1>Hello World</h1>
 </div>
</div>
<style>
   .container {}
   .container .header {}
   .container .header a.logo {}
   .container .header a:hover.logo {}
   .container .header h1 {}
</style>

Do you know if it's possible to achieve this level of automation?

Answer №1

Take a look at primercss. It seems like exactly what you're looking for.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

"Flexbox perplexity: unraveling the mysteries of

body{ font-family: "Roboto", "Helvetica","Sans-serif"; margin: 0; padding: 0; font-size: 1rem; font-weight: 400; color: #777; line-height: 1.7; } h1,h2{ font-family: "Playfair Display", serif; font-weight: 500; } .agent ...

Is it possible for a div element to maintain a fixed position even as its size changes

Looking to adjust the size of a ruler? In horizontal mode, the ruler expands and contracts as you resize it. However, in vertical mode, the ruler shifts left as you shrink it and right as you expand it. You can resize the ruler by dragging the small r ...

Extend the width of a div element to fit the size of its absolutely positioned

I am facing an issue with a Div that contains multiple absolutely positioned divs. The clickable area of the main div expands to cover the children, but the drawn area does not. I need the drawn area to encompass all the container divs. You can view a JSF ...

Tips for incorporating line breaks into GridList components with dynamic tiles in AngularJS

I've implemented Grid List(dynamic tiles) in my AngularJS project and tried using the <br/> tag, but it doesn't seem to be functioning as expected. Below is a snippet of the code: <div ng-controller="gridListDemoCtrl as vm" flex="" ng- ...

Instructions for submitting three different forms from three separate pages simultaneously

I am facing a challenge where I have 3 forms spread across 3 different pages, with the submit button located on the 3rd page. Is there a way to submit all 3 forms simultaneously by clicking on the submit button? Are there any solutions available in javascr ...

How can you horizontally align a collection of elements using CSS?

I'm struggling to align a paragraph element with a group of button elements using jQuery and CSS. This is my issue: My goal is to have all these elements on the same horizontal line at the top of the screen to make the most of the pixel real-estate. ...

Does the height of the rendered font adjust based on the length of words in Japanese formatting?

I can't figure out why this strange issue is occurring... It seems that the font "size" (or rather, the height it occupies) changes depending on the length of a word. I tried to reproduce this in English without success, but it consistently happens w ...

Nivoslider fails to display images when loaded in dynamic ajax content for the first time

Working on a website using jQuery and Ajax, I encountered an issue. When a page loads dynamically for the first time (before images are cached), the images do not display. However, when I reload the ajax load function, the pictures suddenly appear. $("#ov ...

Create a screen divided into two separate sections using horizontal split dividers

Trying to figure out how to set a div in HTML and then have a second div take up the remaining space. It seems like it should be simple, but I'm struggling with it. I'd like to have a div with a fixed height and then have another div take up the ...

Issues with the TableSort plugin in asp.net

Let's get started: I have a basic table in an ASP page <table id="provasort" class="tablesorter"> <thead> <tr> <th>head1</th> <th>heade2& ...

When the left/top/right/bottom properties are not specified, using position:fixed produces the desired results in Firefox and Internet Explorer, but not in Safari

It's unfortunate that I have to bring up another question related to position:fixed, but after going through various other questions and forum threads, I'm still not clear on this particular issue. The code below is a simple illustration of how ...

What is the best method for transferring information from an HTML webpage to a three.js application using Node.js

I am attempting to transfer data from text input fields within an HTML form (such as the length, width, and height of a cube) to a three.js view. Despite using a post request with Express, I am struggling to pass the data into the three.js view. It is wor ...

Maintain consistent distance between checkboxes and their corresponding labels

I have a set of 10 checkboxes that look like this: [] Arts [] Dance [] Karate [] Volleyball [] Basketball Currently, I am using the following CSS styles: #tagstype_tags .tag_select { padding-left: 240px !important; width: 500px !impor ...

Implementing a filter in React with data fetched from MongoDB

Hey there! I'm encountering an issue while using the code in Project.jsx and ProductList.jsx. Every time I run the code, it gives me this error message: Warning: Each child in a list should have a unique "key" prop. Check the render method of Product ...

The top of the page does not align with the HTML body even when the margin is set to 0

I am facing an issue with my Ruby on Rails app where the body content is not displaying at the top of the page. Here is a screenshot of the problem: I have double-checked all the properties and everything seems to be set correctly. If you want to take a l ...

The process of sending a file and then showcasing it once it has been received

I'm having trouble uploading a file to my php server and displaying the image to the user. Despite printing out what seems to be the correct file destination with echo($fileDestination);. Below is the HTML code: <!DOCTYPE html> <html> ...

Issue with sliding out in jQuery

Facing a problem with my jQuery animations. Successfully implemented the slide in effect for my flex sidebars, but struggling with the slide out effects. The slide out function is causing the sidebars to vanish instantly. I think I need to incorporate the ...

Is there a way to extract the ID or other attributes from a clicked element using AMP HTML and incorporate them to generate a URL for an anchor tag?

I have a collection of checkboxes, each with its own unique ID. When a checkbox is clicked, I need to extract the ID and generate a string like '/some/path/?myids=checkOne,checkTwo' (where checkOne and checkTwo are IDs of two different checkboxes ...

A specific image is loading after being clicked in a new page

Despite my efforts to search on various platforms, I have not been able to find a comprehensive solution to my query. Scenario: I currently have a webpage containing a div with multiple images. These images load without any issues and are set to open in ...

How can we use JavaScript to add a class to the <html> element?

What is the method to apply a class to the root element <html> in JavaScript? ...