DEV Community

Discussion on: Create Reusable Web Components in HTML

Collapse
 
starboysharma profile image
Pankaj Sharma • Edited

Hey @anuradha9712
I am also using the web components in my web pages. But I am facing an issue in web components when they load on to the web page. I have notice if I run my code in slow network. First HTML loads then after CSS took place.
Image description

Desired Behavior:
I want first CSS load for all of the web components after that HTML should be visible. Can anyone help me out.

Code

<body>
    <my-header></my-header>
    <my-main></my-main>
    <my-sidebar></my-sidebar>
    <my-section></my-section>
    <my-footer></my-footer>

  // Components JS Loads before the body tag
</body>
Enter fullscreen mode Exit fullscreen mode