PHP in my CSS to solve overlap?

Discussion in 'PHP' started by mark_s, Jun 23, 2007.

  1. #1
    The height of the left navigation bar on my site correctly affects the container's height. So the taller the left navigation the more the main container grows. That's good but here's my issue.

    The rightbar navigation is an 'absolute' and therefore if it grows bigger than the leftbar it will overlap the container.

    I think there is a way to resolve my issue but it involves small bit of PHP in my CSS and I'm hoping someone here can tell me the code.

    The instructions:

    The height value in the 'leftnav' style will have PHP that says: IF rightnav's height is bigger than leftnav's then use rightbar's height value OTHERWISE use this height.

    Can this be done?
     
    mark_s, Jun 23, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    Put your css in a file named css.php and use <?=$myvar ?> sort of syntax where you need dynamic values, you can then use link href tags to link the css to the page and because it's a php script when apache is invoked the php is parsed.
     
    krakjoe, Jun 23, 2007 IP
  3. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I renamed mw.css to mw.php and then called it in the header like this: <link media="all" href="/mw.php" type="text/css" rel="stylesheet" />

    But the browser loaded the site as if there was no CSS.
     
    mark_s, Jun 23, 2007 IP
  4. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #4
    dont absolute position the right bar. there's no reason for it. float is magical. that way when the right nav bar grows, so does the container to the longest nav bar. and then use a bg image on the container to make it appear as if the columns are all the same height.
     
    ansi, Jun 23, 2007 IP
  5. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I have 3 columns on my site and I'm pretty sure at the time I messed about with floating quite a bit. I want the middle column to show first in the source code for SEO reasons and at the time I don't think there was any other way than absoluting the right bar.
     
    mark_s, Jun 23, 2007 IP
  6. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Can someone help?

    "I renamed mw.css to mw.php and then called it in the header like this: <link media="all" href="/mw.php" type="text/css" rel="stylesheet" />

    But the browser loaded the site as if there was no CSS."
     
    mark_s, Jul 1, 2007 IP
  7. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #7
    header("Content-type: text/css")
     
    MMJ, Jul 2, 2007 IP
  8. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thank you, that worked.
     
    mark_s, Jul 2, 2007 IP
  9. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #9
    lol, just wrote that, wasn't thinking.

    Glad to have helped. :)
     
    MMJ, Jul 4, 2007 IP