项目作业:来指点迷津

项目作业:来指点迷津

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>position-static</title>
    <link rel="stylesheet" href="./reset.css"> 
<style type="text/css">
   .header{
    width: 100%
    height:100px;
    background-color: #07cbc9;
    color:white;
    overflow:hidden;

   }
   .header .a{
    float:left;
    font-size: 20px;
    margin-left:50px;
    margin-top:30px;
   }
   .header .b{
    float:right;
    font-size: 10px
    font-weight:bold;
    margin-bottom:15px;
    margin-right:50px;
   }
   .header .b ul li{
    float:left;
    list-style:none;
    padding:20px;
    text-align:center;
    
    
   }
   
   .banner .bbanner .cbanner{
    margin:auto auto;
    margin-top:300px;
    left:0;
    
    
   
   }
   .banner .abanner img{
       position:absolute;
       width:100%;
       height:600px;
   }
</style>
</head>
<body>
   <div class="header">
     <div class="a">Career Builder</div>
     <div class="b">
       <ul>
        <li>HOME</li>
        <li>ABOUT</li>
        <li>GALLERY</li>
        <li>FACULTY</li>
        <li>EVENTS</li>
        <li>CONTACT</li>
       </ul>
     </div>
   </div>
   <div class="banner">
     <div class="abanner">
       <img src="D:\UsersData\0200036\桌面\images\banner3.jpg">
       <div class="bbanner">
        <table  class="cbanner">
         <tr>
           <td> <input type="text" placeholder="your Name"></td>
         </tr>
         <tr>
           <td> <input type="text" placeholder="your Phone"></td>
         </tr>
         <tr>
           <td> <input type="text" placeholder="your Email"></td>
         </tr>
         <tr>
           <td> <input type="text" placeholder="Write Your Comment Here"></td>
         </tr>
         <tr style="border:0"><td><button>SEND MESSAGE</button>
           
           </td></tr>
       </table>
     </div>
     </div>
   </div>
</body>    
</html>

怎么让表单居中在图片中间,。可以引用本机图片吗?怎么引用

正在回答

登陆购买课程后可参与讨论,去登陆

2回答

1、可以引用本机照片:例如的的我的图片存放位置:C:\Users\Administrator\Desktop\images

图片的引用地址为:

<img src="C:\Users\Administrator\Desktop\images\banner3.jpg">

你也可以使用相对这个html文件的路径。比如:

http://img1.sycdn.imooc.com//climg/5b3dcd1c0001a9be06800252.jpg

引用地址如下:

<img src="./images/banner3.jpg">

2、可以把图片设置为  

 position:relative;

       width:100%;

表单设置为:

 position:absolute;

     left:50%;

    top:0px;

    margin-left: -90px; (90px既表单长度的一般。)


修改后的代码如下所示:

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>position-static</title>
    <link rel="stylesheet" href="./reset.css"> 
<style type="text/css">
   .header{
    width: 100%
    height:100px;
    background-color: #07cbc9;
    color:white;
    overflow:hidden;
 
   }
   .header .a{
    float:left;
    font-size: 20px;
    margin-left:50px;
    margin-top:30px;
   }
   .header .b{
    float:right;
    font-size: 10px
    font-weight:bold;
    margin-bottom:15px;
    margin-right:50px;
   }
   .header .b ul li{
    float:left;
    list-style:none;
    padding:20px;
    text-align:center;
     
     
   }
    
   .banner .bbanner .cbanner{
    margin:auto auto;
    margin-top:300px;
    left:0;
     position:absolute;
     left:50%;
	 top:0px;
    margin-left: -89px;
   }
   .banner .abanner img{
       position:relative;
       width:100%;
       height:600px;
   }
</style>
</head>
<body>
   <div class="header">
     <div class="a">Career Builder</div>
     <div class="b">
       <ul>
        <li>HOME</li>
        <li>ABOUT</li>
        <li>GALLERY</li>
        <li>FACULTY</li>
        <li>EVENTS</li>
        <li>CONTACT</li>
       </ul>
     </div>
   </div>
   <div class="banner">
     <div class="abanner">
       <img src="./images/banner3.jpg">
       <div class="bbanner">
        <table  class="cbanner">
         <tr>
           <td> <input type="text" placeholder="your Name"></td>
         </tr>
         <tr>
           <td> <input type="text" placeholder="your Phone"></td>
         </tr>
         <tr>
           <td> <input type="text" placeholder="your Email"></td>
         </tr>
         <tr>
           <td> <input type="text" placeholder="Write Your Comment Here"></td>
         </tr>
         <tr style="border:0"><td><button>SEND MESSAGE</button>
            
           </td></tr>
       </table>
     </div>
     </div>
   </div>
</body>    
</html>

如果我的回答解决了你的疑惑,请采纳!祝学习愉快!

  • 慕九州7737153 提问者 #1
    再教怎么改这图片里的变格大小,我试过我的方法,没让它变大
    2018-07-05 16:19:40
  • 慕九州7737153 提问者 #2
    非常感谢!
    2018-07-06 08:40:07
好帮手慕阿莹 2018-07-05 16:32:21

我们可以给td加上class名称,例如:

<table  class="cbanner">
         <tr>
           <td class="ip1"> <input type="text" placeholder="your Name"></td>
         </tr>
         <tr>
           <td class="ip1"> <input type="text" placeholder="your Phone"></td>
         </tr>
         <tr>
           <td class="ip1"> <input type="text" placeholder="your Email"></td>
         </tr>
         <tr>
           <td class="ip2"> <input type="text" placeholder="Write Your Comment Here"></td>
         </tr>
         <tr style="border:0"><td><button>SEND MESSAGE</button>
            
           </td></tr>
       </table>

并给它们设置宽高

 .banner .bbanner .cbanner .ip1 input{
width:300px;
height:30px;
bolder:2px;
   }
   .banner .bbanner .cbanner .ip2 input{
width:500px;
height:70px;
bolder:2px;
   }


问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
从网页搭建入门Java Web2018版
  • 参与学习           人
  • 提交作业       1088    份
  • 解答问题       10204    个

如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!

了解课程
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师