Write Css Codes Distinct From Different Pages

NO IMAGE
1 Star2 Stars3 Stars4 Stars5 Stars 給文章打分!
Loading...

In rails, there is normally a view corresponding to an action. So if you want to do some special styles based on different pages, you can render controller name and action name in your layout file like this:

<body class="#{controller_name} #{action_name}">
<!-- Render something -->
</body>

Let’s assumpt that your current page controller is ProductsController

相關文章

前端開發 最新文章