三行布局,主要元素和居中内容中有两个背景图像

时间:2015-05-06 19:17:20

标签: html css

  1. 我尝试使用动态页脚创建三行布局。页脚的高度应该使用" rest"屏幕,因为其他两个部分有固定的高度值。现在,页脚根本没有显示:
  2. 
    
    	body {
    	  width: 100%;
    	  height: 100%;
    	  margin: 0px;
    	  padding: 0px;
    	}
    	header {
    	  background-color: red;
    	  height: 70px;
    	}
    	main {
    	  background-color: green;
    	  height: 30%;
    	}
    	footer {
    	  background-color: blue;
    	}
    	#left_image {
    	  background-image: (left.jpg);
    	  height: 100%;
    	  /* auto width for proper image scaling */
    	}
    	#right_image {
    	  background-image: (right.jpg);
    	  width: 50%;
    	  /* auto height for proper image scaling */
    	}
    	#content {
    	  width: 100%;
    	  margin: 3em 1em;
    	  z-index: 1;
    	}
    	
    
    <body>
      <header></header>
      <main>
        <div id="left_image"></div>
        <div id="right_image"></div>
        <div id="content">This content is in front of the background-images</div>
      </main>
      <footer></footer>
    </body>
    &#13;
    &#13;
    &#13;

    1. 我想在main容器的左侧和右侧放置两个背景图像,main的内容应居中(水平和垂直)并位于背景图像的前面。我该怎么做到最好?我尝试使用background-image的容器。我真的必须使用三格容器吗?

0 个答案:

没有答案