How to write page specific CSS in backbone js


Tags: css,backbone.js

Problem :

I have backbone application and wanted to write custom css applicable only for a particular page. Something like how we write in <style></style> tags in html pages. Is there a way to write similar code in the corresponding dust files in backbone js. I don't want to dynamically add css file in the view js files, because my page specific css will be one or two lines and it is different for every page.

EDIT:

I have jq editor as shown below and it gets rendered dynamically(hence, cannot write inline css) and it is used in multiple pages across my application and I want to control its height, width and other properties in a particular page. That is why I need write page specific css, this page is written in backbone js (.dust, view.js and model.js). enter image description here



Solution :

my page specific css will be one or two lines and it is different for every page

Since it's small, I don't think there will be a problem with loading this CSS before hand via a css file.

You can simply have a selector for each page and specify the CSS like:

#page1 .editor{
/*^---unique selector of page*/
  height:100%;
  width:50%;
}
#page2 .editor{
/*--------^---selector of editor*/
  height:80%;
  width:60%;
}

    CSS Howto..

    How to replace fixed values in responsible form css

    How to style Java FX TableView column header using CSS

    How to fit images into keeping the exact size of

    How to target iPhone 3GS AND iPhone 4 in one media query?

    Showing images in placeholder on focus

    How to create vertically centered meeting borders on a div?

    HTML/CSS: How to make a bar on the side to take you to a certain part of the page

    How to style a

    inside a div with css [closed]

    css - how to determine why a particular css rule is being overwritten

    How I can center a menu bar with ul

    How to draw diagonal lines with css [duplicate]

    How to simulate pixel ratio to test media queries with Google Chrome or Firefox on Windows?

    How can I make a drop down menu without changing the width of the main menu item?

    How to find the proper offsets for CSS sprites?

    How to click an element by innerthtml using CSS selectors in Selenium

    How to align pictures on a menu bar?

    Print CSS: How do I open a new tab of the current page and append CSS?

    How can I adjust image width and height to 100 x 100 keeping ratio?

    How to recreate this image using css

    How do I center a dynamic div?

    How can i refer to all of my tags in CSS?

    How to create Two Columns with Separate Scrollbars in Responsive Bootstrap?

    How to edit Skype contact me button CSS?

    How to correctly override default JavaFX 8 CSS on TableView

    How to get css to work in Django [closed]

    How to override css for giving background image?

    How to set the specificity of a css over-ride class for XPages

    how to align editor-label with editor-field in css

    How to have two css animations in one tag

    How to switch between css with jquery