meltingpoint Posted September 7, 2011 Share Posted September 7, 2011 page1.php (static html page properties) page2.php (references an external css style sheet) When I include page2.php inside page1.php via php - page1 adopts the css style of page2 Is there a way to stop this? Frustrated. Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted September 7, 2011 Share Posted September 7, 2011 well it depends a bit. I would say use other specific id's or classes for page1 and set a style to those. Quote Link to comment Share on other sites More sharing options...
meltingpoint Posted September 7, 2011 Author Share Posted September 7, 2011 Well- it is the page background that is being inherited. So the background from one is over riding the other. How then to do as you suggested if it is the background specifically that I want different on each page? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted September 7, 2011 Share Posted September 7, 2011 as you might have guessed and if not read in the forum guidelines. It would be great if you could show some code and make more precise what your problem is. Unless of-course you want me to repeat exactly what I said before. If you have an online example of it it would be even better so we can check it out. Quote Link to comment Share on other sites More sharing options...
wright67uk Posted September 8, 2011 Share Posted September 8, 2011 Why can't you seperate your css and simply refrain from calling it? Quote Link to comment Share on other sites More sharing options...
meltingpoint Posted September 8, 2011 Author Share Posted September 8, 2011 index.php : is a page made with a WYSIWYG program, has the text -Berkshire Systems LLC, has an html box which is a division named "background" and the pages color is white as set in the page properties page1.php: is a page made with a WYSIWYG program, has the text -This is the included page, has <link rel="stylesheet" type="text/css" href="test_style.css"/> placed between the head tags and its default color is white as set in the page properties. test_style.css has the following body {background-color: grey;} when viewing page1.php (www.taskforcecentral.com/dev2/page1.php) you get the page which displays the proper text as described above and the back ground is grey. when viewing index.php (www.taskforcecentral.com/dev2/index.php) all of the page(s) are grey instead of the only the div "background" being grey and the rest of the index being white. So the index.php includes the page1.php and inherits the grey background as defined in the test_style.css. So that is where I am at. The created div of "background" which contains the included page1.php changes the whole page instead of just the background of the div- background. Quote Link to comment Share on other sites More sharing options...
wright67uk Posted September 8, 2011 Share Posted September 8, 2011 Why not contain everything within a div named eg. #container and give it a background color. Use this on page one. Eg. Div id = container.... And on page 2 #container2. div id = container2 This way you will only have one css and nothing will get muddled up as the two areas in question will have different names. Quote Link to comment Share on other sites More sharing options...
meltingpoint Posted September 8, 2011 Author Share Posted September 8, 2011 just how to create a container with the WYSIWYG program is the question. The problem is that no matter what I do- the page that is including another page always inherits the background color of the page it is including, even if I separate via div. Quote Link to comment Share on other sites More sharing options...
wright67uk Posted September 8, 2011 Share Posted September 8, 2011 Under body {background-color: grey;} Add #div1 {background-color: grey; width:100%; height:100%;} #div2 {background-color: blue; width:100%; height:100%;} Now put your content into; <body> <div id ="div1"> content here</div> And the same for div 2 on page 2 Quote Link to comment Share on other sites More sharing options...
meltingpoint Posted September 8, 2011 Author Share Posted September 8, 2011 Did not work. Still inherited the color of the included page. Frustrating.................... Quote Link to comment Share on other sites More sharing options...
wright67uk Posted September 8, 2011 Share Posted September 8, 2011 Post your revised code php html css and a link to your page then we can say where your going wrong. What editor have you got? Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted September 8, 2011 Share Posted September 8, 2011 Did not work. Still inherited the color of the included page. Frustrating.................... Don't use a wysiwyg editor... period! Also I just checked https://www.taskforcecentral.com/dev2/index.php and i don't see any grey stuff you talked about or more important what is page 1 or 2. Besides that you omitted to close you <body> tag (<body ) A simple setup could look like this: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head><meta charset="UTF-8" /> <link type="text/css" rel="stylesheet" href="css/style.css" /> <link rel="icon" type="image/x-icon" href="favicon.ico"/> <title>example</title> </head> <body> <div id="wrapper"> <div id="page1"> </div> <div id="page2"> </div> </div> </body> </html> than by using #page1 or #page2 you can target the inner elements and set a style to them. Quote Link to comment Share on other sites More sharing options...
meltingpoint Posted September 9, 2011 Author Share Posted September 9, 2011 cssfreakie- It is indeed the WYSIWYG editor that is causing the problem for when I build a standard php page setting the div1 and div2 and including a page with in that- it all works fine. So I will have to experiment to see if I can override the WYSIWYG editor. Meanwhile- I will work on your example. Thanks very much for the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.