But I have n number of pages created from that document type and cshtml and I want css for only 1 particular page which obviously don't have cshtml so how can it be applied.
I've done this a lot, usually it's CSS based on just the document type (applying to many pages) but you can definitely do it like this too, using the Id to make it page-specific.
Apply CSS to specific page created using document type and template
Hi,
I have page created from document type using template.
I want to apply CSS only to specific page. How can I apply it.
Thanks, Rohit
Hey Rohit.
You can just reference it in the head tag in your cshtml file for that specific document type :)
We have a tutorial on how to build a simple site here - https://our.umbraco.com/documentation/Tutorials/Creating-Basic-Site/ - so give it a look.
Alternatively, you can install the starter kit on your project and just check how the templates are built.
Thanks for quick reply.
But I have n number of pages created from that document type and cshtml and I want css for only 1 particular page which obviously don't have cshtml so how can it be applied.
Thanks.
Hmm, why don't you simply create a separate document type + template for that specific page if it's only one of a kind?
Thanks again. Good solution but for 5-6 line css changes I don't want to create separate document type and template.
Thinking some simple solution kind of inline CSS.
How about using the rich text editor and just adding the code there? That way you can add it to a specific section of a specific page.
Thanks Lindow.
I will try and check.
Hi Rohit,
I suggest you add something like this to your Master Layout template:
Then you can write a page-specific CSS selector like this:
I've done this a lot, usually it's CSS based on just the document type (applying to many pages) but you can definitely do it like this too, using the Id to make it page-specific.
/Chriztian
Thanks Chriztian..
Will try and let you know.
is working on a reply...