Styles not fully applying when loading nested view |
[eluser]zulubanslee[/eluser]
I want to modularize a little, so my menu section is one view and my sidebar is another and the footer another. I wanted to do this: Here is my controller code: Code: $data['header'] = $this->load->view('header'); Then in the view I have Code: <!--html--> It prints, but see this: http://i.imgur.com/W5sqo.jpg I left out the sidebar and footer because it's more of a mess. With the code in one file it's fine.
[eluser]InsiteFX[/eluser]
Your problem is that you are not passing the $data array to the view! There is 2 different ways of doing this... Code: // First Code: // Second - Which makes $data global. InsiteFX
[eluser]zulubanslee[/eluser]
Eh I tried that and it looks the same. If I forgot to pass the $data variable, how was it the header was passed in the first place, incorrectly positioned or otherwise?
[eluser]InsiteFX[/eluser]
If your talking about your header it's because your div is not centering it! Code: .header { width: 100%; margin: 0 auto; } InsiteFX
[eluser]zulubanslee[/eluser]
Very good. I applied: margin: auto; and that did the trick. I'm a bit curious as to why it aligned ok when it was in the original file, but as long as it works, who cares right? thanks guys!
[eluser]InsiteFX[/eluser]
Your very Welcome! What I showed you will work for centering any divs. InsiteFX |
Welcome Guest, Not a member yet? Register Sign In |