diogo Posted November 7, 2011 Share Posted November 7, 2011 What would be the best way of having dynamic CSS in all pages without making it heavy to process? external style.php with a content-type header instead of style.css internal stylesheet on header.inc, or on a dedicated include other Link to comment Share on other sites More sharing options...
apeisa Posted November 7, 2011 Share Posted November 7, 2011 I think it depends how dynamic it will be. If you need a lot of .css then I would just make module which reads and writes css files. If you need to set few css rules like change bg image or stuff like that, then I would use inline css. Link to comment Share on other sites More sharing options...
Adam Kiss Posted November 7, 2011 Share Posted November 7, 2011 It depends what you need to do this for; Give us little example, and we'll tell you Link to comment Share on other sites More sharing options...
diogo Posted November 7, 2011 Author Share Posted November 7, 2011 In this case it's for a simple construction page. There will be three circles with some info and i want them to be in different positions every time the page loads.I only need dynamic margin-top and margin-left for each circle. For this one It's only one page, so I think I will do it as Apeisa suggested, but I was also wondering how to do it on a bigger website, even if it's only to have variables on css without using something like Sass. Link to comment Share on other sites More sharing options...
Adam Kiss Posted November 7, 2011 Share Posted November 7, 2011 @Diogo: in cases like this, it's safe to go with inline styles - they work everywhere and properly documented, they're also easy to maintain, disregard haters - for simple randomization like this it's okay if you want to do this on bigger scale, I would rather generate 5-10 CSS files (possibly with LESS, SASS, or PHP), and I would randomize which i include (rather than the properties themselves).This, way, you have both randomized CSS and less computing involved/caching available. Link to comment Share on other sites More sharing options...
diogo Posted November 7, 2011 Author Share Posted November 7, 2011 Ok, I will use inline for now. thanks a lot for the answers! Link to comment Share on other sites More sharing options...
ryan Posted November 8, 2011 Share Posted November 8, 2011 I agree with Adam about using inline styles. There is a place where inline styles are appropriate, and this seems like a good example of one. Also, jQuery/Javascript is another thing to consider. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now