dcsimg
www.webdeveloper.com
Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22

Thread: CSS problems

  1. #16
    Join Date
    Aug 2003
    Posts
    25
    Zorg,
    I have finished my nav bar according to your suggestions and it works fine.
    Now I am trying to pull it into an iframe that has basically the same height as the nav bar itself and it shows fine. However the pull-downs only show when I make the iframe unreasonably high, which does, of course, make no sense for a nav bar. Is that normal?
    Thanks again, Ed

  2. #17
    Join Date
    May 2016
    Location
    Southern California
    Posts
    80
    What are you using the iframe for, what effect are you trying to achieve? Are you using the iframe as a container for the navbar? So the iframe height is as tall as the navbar, that would make sense. The contents within the iframe will not exit its frame bounds.

  3. #18
    Join Date
    Aug 2003
    Posts
    25
    Yes, I am trying to use the iframe as a container for the nav bar to avoid having that nav bar html on each page.
    I'm sure there are other ways to pull the nav bar (incl the pull-downs) onto all pages, my knowledge is just too limited in that respect.

  4. #19
    Join Date
    May 2016
    Location
    Southern California
    Posts
    80
    We can do this without an iframe using php. Help me understand a few things first... are you familiar with php? PC or Mac? Do you have a local web server on your machine? What is your current workflow, how are you viewing your changes?

  5. #20
    Join Date
    Aug 2003
    Posts
    25
    Unfortunately, I am not familiar with php.
    I am working on a PC, using Coffeecup HTML editor, which allows me to look at my html/css changes.
    But I can upload any changes to a server and check there, if that helps.

  6. #21
    Join Date
    May 2016
    Location
    Southern California
    Posts
    80
    Ok, that will work.
    You won't need the iframe. We are going to separate some elements and bring them in with php. PHP can be used with html. So the content will not need to change, we are only adding to it.

    1. First rename your index.html to index.php
    2. Create a new file called navbar.php within the same directory as index.php and cut/paste the navbar only. Don't worry about the css, keep it in the index page.
    3. Paste code below into index.php after the body tag


    Within your index.php file, where you want the navbar to appear; paste the following: (make sure it is after the body tag so it appears where you had it originally)
    PHP Code:
    <?php include_once "navbar.php";?>
    Do this on every page you want the navbar. You can include any other page content you create later this way, on multiple pages.

    You can also take it a step further and separate out the header and footer of your page into separate php files and include those.
    Example index.php:
    HTML Code:
    <?php 
    include_once "header.php"; 
    include_once "navbar.php";
    ?>
    <div id="wrapper">
        <?php include "home-content.php";?>
    </div>
    <?php include_once "footer.php";?>
    In the example above, the header.php we would move everything from the <body> tag and up; footer.php would have everything from the closing </body> tag down, from your current index.php. Then on every new page include your header, navbar, content and footer. The home-content.php in the example, would be your main content.

    SIDENOTE: The only thing is, in order for you to see the pages locally on your machine you might need a php server running locally on your machine.

    I recommend you look into installing a local php server on your machine. This makes testing your code easier and without having to ftp changes to your live server every time. A free and easy to setup solution is XAMPP. Here is a link with more info:
    https://www.apachefriends.org/index.html

    Hope this isn't confusing

  7. #22
    Join Date
    Aug 2003
    Posts
    25
    Well, it is a bit confusing.
    I'll try my luck with your suggestions and report back.
    Thanks again.
    Ed

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles