Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Adding class isolated style on blazor component

Adding class isolated style on blazor component

Scheduled Pinned Locked Moved ASP.NET
asp-netcssdatabasetestingbeta-testing
3 Posts 2 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    coco243
    wrote on last edited by
    #1

    Hi, I am trying to add a style class to a blazor component, with isolated style method and when I add the style class on the blazor component located in the index.razor file, the blazor component disapears. I am doing that on a Webassembly Blazor project. So: I have followig files: -Index.razor, where I want to display the razor component

    @page "/"

    Index

    Hello, world!

    Welcome to your new app.

    -DisplayComponent.razor, where the component is defined

    DisplayComponent

    how cool, it works

    -DisplayComponent.razor.css where the style class is defined

    .displayStyle{
    margin:7px;
    }

    So please help me understading and implement this concept of isolated style. When I add class="displayStyle" on the display component in index.razor the content of the "DisplayComponent" disappear. I keep testing but I can't manage implementing a class on a blazor component with isolating style metgod. Give me some sugestions please. What I am missing? Thank you.

    C Y 2 Replies Last reply
    0
    • C coco243

      Hi, I am trying to add a style class to a blazor component, with isolated style method and when I add the style class on the blazor component located in the index.razor file, the blazor component disapears. I am doing that on a Webassembly Blazor project. So: I have followig files: -Index.razor, where I want to display the razor component

      @page "/"

      Index

      Hello, world!

      Welcome to your new app.

      -DisplayComponent.razor, where the component is defined

      DisplayComponent

      how cool, it works

      -DisplayComponent.razor.css where the style class is defined

      .displayStyle{
      margin:7px;
      }

      So please help me understading and implement this concept of isolated style. When I add class="displayStyle" on the display component in index.razor the content of the "DisplayComponent" disappear. I keep testing but I can't manage implementing a class on a blazor component with isolating style metgod. Give me some sugestions please. What I am missing? Thank you.

      C Offline
      C Offline
      coco243
      wrote on last edited by
      #2

      I had discovered where the issue was, I am using google Chrome and I had to clear the cache memory, and when I did that I had to check more checkboxes. I hope that my post help others. Thank you,

      1 Reply Last reply
      0
      • C coco243

        Hi, I am trying to add a style class to a blazor component, with isolated style method and when I add the style class on the blazor component located in the index.razor file, the blazor component disapears. I am doing that on a Webassembly Blazor project. So: I have followig files: -Index.razor, where I want to display the razor component

        @page "/"

        Index

        Hello, world!

        Welcome to your new app.

        -DisplayComponent.razor, where the component is defined

        DisplayComponent

        how cool, it works

        -DisplayComponent.razor.css where the style class is defined

        .displayStyle{
        margin:7px;
        }

        So please help me understading and implement this concept of isolated style. When I add class="displayStyle" on the display component in index.razor the content of the "DisplayComponent" disappear. I keep testing but I can't manage implementing a class on a blazor component with isolating style metgod. Give me some sugestions please. What I am missing? Thank you.

        Y Offline
        Y Offline
        yolanda smith
        wrote on last edited by
        #3

        To use isolated styles correctly: In DisplayComponent.razor, apply the class directly:

        DisplayComponent

        How cool, it works

        In Index.razor, remove the class from the wrapping

        :

        that's how the component will display with the styles applied correctly.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups