Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello Forum,
I have a rather simple question, is it possible to make a css component in my main.css class or a similar solution, according to the user identity
i am not really a fan of having a lot of stying inside of my views if i can avoid it
Example of my .cshtml
@if (User.Identity.Name.Equals("TV")) { <style> .dataTables_filter, .dataTables_info, .dataTables_length, .dataTables_paginate { display: none; } .card-body { padding: 0 5px; } h2 { font-size: 15px; } th, td, tr { font-size: 10px; } .btn-circle { width: 10px; height: 10px; text-align: center; padding: 3px 0; font-size: 6px; line-height: 1; border-radius: 10px; } </style> }
css files are "flat" files - they are (normally) not processed by the server.
I would suggest you embed your custom styles as done in your example.
In the past I have often added classes to the html (or other element) to handle situations like that.
<html class="[email protected]">
And then prefix your styles with that in your main.css file
.user_XXXX .dataTables_filter { ... }
This is how I handle these situations: Add all your classes to your CSS file. They are not processed by the server.
In the view, add something like this:
@{ string class = "some css classes" if(User.Identity.Name.Equals("TV")){ class+=" TV_user_specific_class"; } } <div class="@class">My content</div>
Your CSS file shoud look like this:
.some{ } .css{ } .classes{ } .TV_user_specific_class{ }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
umbraco user identity css component
Hello Forum,
I have a rather simple question, is it possible to make a css component in my main.css class or a similar solution, according to the user identity
i am not really a fan of having a lot of stying inside of my views if i can avoid it
Example of my .cshtml
css files are "flat" files - they are (normally) not processed by the server.
I would suggest you embed your custom styles as done in your example.
In the past I have often added classes to the html (or other element) to handle situations like that.
<html class="[email protected]">
And then prefix your styles with that in your main.css file
.user_XXXX .dataTables_filter { ... }
This is how I handle these situations: Add all your classes to your CSS file. They are not processed by the server.
In the view, add something like this:
Your CSS file shoud look like this:
is working on a reply...