Html div width 100% not functioning

前端 未结 5 654
鱼传尺愫
鱼传尺愫 2021-01-12 04:29

There are some problems with my HTML, so I am posting the code.

The first tag is a div with id=\"header\". I have given it 100% width and g

5条回答
  •  别那么骄傲
    2021-01-12 04:55

    This is the style sheet which works with me:

      body{    
        margin:0;    
        padding:0;
    }  
        .clear{    
        display:block;   
        clear:both;
    }    
        #header{   
        min-height:156px;  
        display: block;
        width:100%;
        background-image:url('http://www.webdesignideas.org/images/bellevueBg.gif');
    }
        #head-contents{    
        width:974px;    
        margin-left:200px;
        height:156px;
    }
        #header ul {    
        margin:85px 23px 0 0;    
        float:right;
        list-style-type:none;
    }
        #header ul li {    
        display:inline;
    }    
        #header ul li a {   
        margin-left:46px;
        font-size:19px;
        color:#fff;
        text-decoration:none;
    }
    
        #header ul li a:hover ,    
        #header ul li a.active {    
        color:#FD7600;
    }
    

    Resizing the window and setting the margins to auto will screw the position of your inner div because it s width doesn t fit the window.

提交回复
热议问题