Home ASP.NET MVC razor: conditional attribute in CSS block
Reply: 0

ASP.NET MVC razor: conditional attribute in CSS block

user506
1#
user506 Published in June 22, 2018, 11:30 am

Can I use if condition in style tag like this?

<style>
    @@media (min-width: 765px) {
    html,body 
       {
        min-width: auto;
        width: 100%;
        @{
            if (ViewBag.type == "pic")
            {
                @:min-height:100vh;
                @:height:auto;
            }
            else {
                @:height: 100vh;
            }
          }
       }
    }
</style>

Or I should use CSS directly in HTML?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.475748 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO