How to insert database values into the template stylesheet?

Tags: jquery,python,css,sqlalchemy,pyramid

Problem :

I have a pyramid app where I insert an entry in my database table on a Zope page template. The chameleon template engine renders it to html. What I want to do is move this entry over by the value column in the database associated with the entry. Here is what I would want to do.

<p class="entries">${}</p>

<style type="text/css">
.entries {
    margin-left: var(entry.value) px;

obviously this is incorrect. Is there a way to do this with JQuery custom css classes perhaps? I don't know how to integrate it with the pyramid framework or the sqlalchemy ORM.

Solution :

Looks like it is exactly the same in the style sheet as it would be in the rest of the template. You just need to use ${} format. I am not sure what you would do if you wanted to put the css in a separate file though.

    CSS Howto..

    How to make <'details'> drop down on mouse hover

    jquery - how to change the display css attribute of a button within a li on hover

    CSS how to change page content depending on page size (zoom) in responsive design

    How to exclude last child in css psuedo class selector

    change of encoding shows Weird symbols

    How to get an image to resize on scroll?

    How to clip inside a box in css?

    How do you modify wordpress css for posts?

    How to make a header that changes position (like Pinterest)

    How do I find out which style is overriding another style?

    How to align div horizontally in this case

    How do i change the styling of a nodes CSS through javascript(d3)

    CSS only - how to have a scrolling ul with all li on one line

    How to avoid form-control in all inputs with Twitter Bootstrap 3?

    How to add bootstrap css to my Wordpress plugin

    how would i get the headline to fade in and move up very slightly on page load with css

    How do I add two buttons side by side that are made up of an image?

    How to change color of Bootstrap warning class table row

    How to center text inside div in this specific situation? [duplicate]

    How to make font-size less for 2px than parent element?

    How to avoid CSS conflict using jquery?

    How do i select only one column when hovering over it in a drop down jQuery menu?

    How to create a “dot-dash” border with css or javascript?

    How to reorganize the page using “div” and “css”?

    How can I add specific css id to parent menu with php or javascript

    How to copy a CSS style from a website for re-use

    How to get the real font name of a div on a web page when it set css font-family?

    How To Make iPhone6 Plus Landscape Mode Work Better with Bootstrap3?

    How do I keep the 'hover' effect while using a Jquery color change effect while scrolling

    Navbar doesn't scroll to show links on smaller devices when using nicescroll plug-in