Grow your CSS skills. Land your dream job.

Dreamweaver always ads space at the top

  • # September 21, 2009 at 11:20 am

    Every time I open a html file in dreamweaver somehow it ads like a 50 pixel high white bar at the top. Seen here http://ezwebserver.com/30650/ads4rides/index.html

    Help urgent!

    Thanks

    # September 21, 2009 at 3:23 pm

    it seems that your menu div being before the header image is creating the problem. I wasn’t able to figure out how to make it appear without the div being before the image. sorry.

    # September 21, 2009 at 10:04 pm

    the first thing you did wrong is that you went div crazy. You don’t need to put so many divs in your code

    Code:

    What you should have done is made your header image a background image. Here is the improved code. notice what I took out of your code. Notice how many fewer lines of code there is. It’s cleaner, easier, less typing and it makes it far easier to find errors. Don’t nest so many divs when you don’t need to. This will give you less to look through when you do find a problem. You also had many unclosed

    Code:

    The proper way to make a br tag is

    Code:

    When you are having issues with your code. One of the things you can do is validate your css and your html with the validator. There is a css one also

    http://validator.w3.org/

    Code:
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    Customer service and satisfaction are our first priority!

    Experience advertising success.

    Let our company, help your company today!

    – Joanne, Josie, and Sally

    We Drive Your Magnets

    In the current economy advertising can be a low priority for any business, yet it is the heart and soul for the survival of your business.

    Advertising can be one of the biggest expense any company has to bear, and can cost anywhere from $400 to $600 for a one-time, one-location exposure.

    Ads 4 Rides is thinking outside of the box. We give you the opportunity to profit without breaking the bank. Ads 4 Rides specializes in mobile advertising.

    Here is how it works:

    Ads 4 Rides is a mobile advertising company. We advertise your company on an automobile or automobiles that travel daily in the area or areas you wish to achieve more business.

    That car will come in sight of hundreds or even thousands of people just looking around while driving or waiting at a red light. Now your company has been seen and recognized by shoppers always looking to support neighborhood businesses for the product or service they need.

    Imagine the constant exposure your business will get just by dropping off the kids at school, lunch with friends, shopping mall, grocery store, picking up the kids from school, soccer practice, maybe an errand or two in the evening.

    You can choose to advertise on as many vehicles as you see fit.
    Ads 4 Rides will be able to provide your advertisement on vehicles that travel long distances. These distances will broaden your business beyond its borders.

    Dot.com companies have even more of a challenge as they dont have a store front to let the neighborhood know about their product or services. As with any business, advertising is as crucial to a computer business. By getting your name out to the public Dot.com companies, your business can spread to great lengths.

    Do not let a lack of advertising funds determine your companys worth. Keep your expenses low and allow Ads 4 Rides to help you gain success and bring business to your doorstep.

    – Take your Ad 4 a Ride –



    here is the improved css

    Code:
    < !–
    body {
    font: 100% Verdana, Arial, Helvetica, sans-serif;
    background: #666666;
    margin: 0; /* it’s good practice to zero the margin and padding of the body element to account for differing browser defaults */
    padding: 0;
    text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
    color: #000000;

    }

    h1 { font-family: Times; font-size: 23px; color: #0055A5; text-align: center;
    }

    p { font-size: 12px; }

    .thrColFixHdr #container {
    width: 900px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */

    background: #FFFFFF;
    margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
    border: 1px solid #000000;
    text-align: left; /* this overrides the text-align: center on the body element. */
    }
    #header {
    width: 900px;
    height: 160px;
    background:url(images/header.jpg) no-repeat;
    /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
    }
    #header h1 {
    margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse – an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
    padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */

    }
    #sidebar1 {
    float: left; /* since this element is floated, a width must be given */
    width: 274px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */
    height: 688px;
    background: url(images/adsidebar.jpg) top left no-repeat;
    text-align: center;
    color: #0055A5;
    background-color: #7FC241;
    }

    .thrColFixHdr #mainContent {
    /*margin: 0 200px; the right and left margins on this div element creates the two outer columns on the sides of the page. No matter how much content the sidebar divs contain, the column space will remain. You can remove this margin if you want the #mainContent div’s text to fill the sidebar spaces when the content in each sidebar ends. */
    /*padding-left:101px;*/
    float: right;
    margin-right: 20px;
    width:578px;
    }
    .thrColFixHdr #footer {
    padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
    background-image:url(images/footer.jpg)

    }
    .thrColFixHdr #footer p {
    color:gray;
    font-size:10px;
    margin:0;
    padding-top:12px;
    text-align:center;
    }
    .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    float: right;
    margin-left: 8px;
    }
    .fltlft { /* this class can be used to float an element left in your page */
    float: left;
    margin-right: 8px;
    }
    .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
    clear:both;
    height:0;
    font-size: 1px;
    line-height: 0px;
    }

    .ads4rides {font-weight: bold; color: #0055A5;}

    #sidebarcopy { font-family:Times;
    font-size:16px;
    margin: 0 auto;
    padding-top: 420px;
    width:188px;
    }

    /* Navigation*/

    #nav { position: relative; top: 135px; }

    #nav ul
    {
    list-style: none;
    padding: 0;
    margin: 0;
    }

    #nav li
    {
    float: left;
    margin: 0 0.15em;
    }

    #nav li a
    {
    font-size:9px;
    height: 2em;
    line-height: 2em;
    float: left;
    width: 9em;
    display: block;
    border-right: 0.3em solid white;
    color: white;
    text-decoration: none;
    text-align: center;
    }

# September 23, 2009 at 11:36 am

Thanks a million Cybershot. You are right, I need to minimize the code to the max.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".