Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.6.5

Request #5177 CSS declarations and CSS stylesheets should be rendered in the given order
Submitted: 2005-08-22 21:55 UTC
From: malbe at adinet dot com dot uy Assigned:
Status: Wont fix Package: HTML_Page2
PHP Version: 4.3.10 OS: Linux 2.4.26
Roadmaps: (Not assigned)    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2009-08-12 03:48 UTC
Package:
Bug Type:
Summary:
From: malbe at adinet dot com dot uy
New email:
PHP Version: Package Version: OS:

 

 [2005-08-22 21:55 UTC] malbe at adinet dot com dot uy
Description: ------------ HTML_Page2 version: 0.5.0beta To be more clear, let me define two terms first: - style declaration: css style added using "HTML_Page2::addStyleDeclaration()" - stylesheet: css file added using "HTML_Page2::addStyleSheet()" Now, to the "bug": To follow the real spirit of CSS, stylesheets and style declarations should be rendered inside the <head> in the order that the programmer adds them, instead of adding all the stylesheets first and then the style declarations. The problem with the current method is that if you want to overwrite some properties of a style declaration with a stylesheet, you simply can't, because your stylesheet will always appear before the styel declaration, thus giving exactly the opposite result than the expected (the style properties in the stylesheet are overwritten with the ones in the style declaration) Test script: --------------- <?php require_once 'HTML/Page2.php'; $some_css_declaration = 'html, body { background-color: #EEE; }'; $p = new HTML_Page2(); // add a declaration with a grey background $p->addStyleDeclaration($some_css_declaration); // try to overwrite background-color property of the html, body selectors // using the ones in this stylesheet $p->addStyleSheet('http://www.w3.org/StyleSheets/home.css'); // add some content... $p->addBodyContent('The background should be white, as declared in the StyleSheet, but it\'s grey, as specified in the $some_css_declaration style declaration'); $p->display(); ?> Expected result: ---------------- The page's body background should be white Actual result: -------------- The background appears grey (Due to the fact that the order in which the stylesheets and declarations appear in the <head> isn't the same order in which they were added)

Comments

 [2005-08-22 23:06 UTC] thesaur
OK, I'll see what I can do about it. It will require some internal changes, but I think I can work it out without too much trouble :)
 [2006-11-01 05:19 UTC] iwarner at php dot net (Ian Warner)
To override a style declaration with a style sheet seems an odd way to do things. You obviously have control over the declarations and so should try to minimise this output within your code. The usual method it to overwrite a style sheet with a declaration, which works fine as you have experienced with the all grey. Please provide a real world scenario of why you want to do this, so we can further understand then we will look into it.
 [2009-08-12 03:48 UTC] cweiske (Christian Weiske)
-Status: Assigned +Status: Wont fix
There is no real reason for this feature - and it would cause too much trouble internally.