如何用CSS的autoflow属性实现电影院选座效果

Admin 2022-06-14 群英技术资�

这篇文章给大家分享的是“如何用CSS的autoflow属性实现电影院选座效果”,对大家学习和理解有一定的参考价值和帮助,有这方面学习需要的朋友,接下来就跟随小编一起学习一下吧�

1.autoflow属性,如果元素内容的长宽超出元素本身的长宽则会出现滚动�

<HTML> 
<HEAD> 
<TITLE>测试表格内的滚动�</TITLE> 
</HEAD> 
<BODY> 
<div id="wins" 
        style="position:absolute;height:200;width:200;overflow:auto;background:#EEEEEE;"> 
        <p>pppppppppppppppppppppppppppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppppppppppppppppppppppppppp </p> 
        <p>ppppppppppppppppppppppppp </p> 
        <p>ppppppppppppppppppppppppp </p> 
        <p>ppppppppppppppppppppppppp </p> 
        <p>ppppppppppppppppppppppppp </p> 
        <p>ppppppppppppppppppppppppp </p> 
        <p>ppppppppppppppppppppppppp </p> 
        <p>ppppppppppppppppppppppppp </p> 
        <p>ppppppppppppppppppppppppp </p> 
        <p>ppppppppppppppppppppppppp </p> 
        <p>ppppppppppppppppppppppppp </p> 
      </div>
</BODY> 
</HTML>

效果如下

2.选座位页�

<html>
<head>
 <meta charset="utf-8"> 
 <title>座位</title>
 <meta name="viewport"
 content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
 <link rel="stylesheet" href="https://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
 <script src="https://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
 <script src="https://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
 <style type="text/css">
      table tr td{
        padding: 5px;
      }
     </style>
      </head>
   <script>
  function createTable(){
var DivW=600;
var DivH=400;
var length=30;
var height=$("#h").val()/1;
var width=$("#w").val()/1;
var TableW=width*(length+3);
var TableH=height*(length+3);
$(".main").empty();
$(".main").width(TableW).height(TableH);
for(var a=0;a<height+1;a++){
 var str="<tr>";
 for(var b=0;b<width+1;b++){
  if(a==0&&b>0){
   str+='<td height="30px" width="30px">'+b+'</td>';
  }
  if(b==0&&a>0){
     str+='<td height="30px" width="30px">'+a+'</td>';
  }
  if(b>0&&a>0){
   str+='<td height="30px" width="30px" ><img src="img/2.png" width="30px" height="30px" /></td>';
  }
  
  if(a==0&&b==0){
    str+='<td height="30px" width="30px"></td>';
  }
 }
 str+="</tr>";
 $(".main").append(str);
}
  }
   </script>
<body>
<!-- 按钮触发模态框 -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" onclick="createTable()">
 座位
</button>
<input type="text" id="h" />�<input type="text" id="w" />�
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <div class="modal-dialog">
        <div class="modal-content">
   <div id="wins" style="position:absolute;height:400;width:600;overflow:auto;background:#ffffff;"> 
    <table class="main" style="text-align:center;">   
    </table>
   </div>
  </div>
 </div>
</div>
</body>
</html>

效果如下

总结


这篇关于“如何用CSS的autoflow属性实现电影院选座效果”的文章就介绍到这了,更多相关的内容,欢迎关注群英网络,小编将为大家输出更多高质量的实用文章!
标签� autoflow属�

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:[email protected]进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容�

猜你喜欢

群英网络开启智能安全云计算之旅

注册领取新人大礼�
专业资深工程师驻�
7X24小时快速响�
一站式无忧技术支�
免费备案服务

联系我们

24小时售后 24小时售后TEL�0668-2555666 售前咨询TEL�400-678-4567 投诉建议TEL�0668-2555999 投诉建议邮箱:t[email protected] 信息安全TEL�0668-2555118 域名空间客服 公司总机�0668-2555555 公司传真�0668-2555000
免费拨打  400-678-4567
免费拨打  400-678-4567 免费拨打 400-678-4567 � 0668-2555555
在线客服
微信公众号
返回顶部
返回顶部 返回顶部