CSS uses the autoflow attribute to achieve seat selection effect

CSS uses the autoflow attribute to achieve seat selection effect

1. Autoflow attribute, if the length and width of the element content exceeds the length and width of the element itself, a scroll bar will appear

<HTML> 
<HEAD> 
<TITLE>Testing the scroll bar in the table</TITLE> 
</HEAD> 
<BODY> 
<div id="wins" 
        style="position:absolute;height:200;width:200;overflow:auto;background:#EEEEEE;"> 
        <p>pppppppppppppppppppppppppppppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppppppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppp </p> 
        <p>pppppppppppppppppppppppppp </p> 
      </div>
</BODY> 
</HTML>

The effect is as follows

2. Seat selection page

<html>
<head>
 <meta charset="utf-8"> 
 <title>Seats</title>
 <meta name="viewport"
 content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
 <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
 <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
 <script src="http://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 triggers the modal box-->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" onclick="createTable()">
 Seat</button>
<input type="text" id="h" />Row<input type="text" id="w" />Seat<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>

The effect is as follows

Summarize

The above is what I introduced to you. I use the autoflow attribute of CSS to achieve the seat selection effect. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

<<:  Detailed explanation of the use of router-view components in Vue

>>:  W3C Tutorial (10): W3C XQuery Activities

Recommend

Pure CSS to achieve the list pull-down effect in the page

You may often see the following effect: That’s ri...

Detailed tutorial on running selenium+chromedriver on the server

1. Introduction I want to use selenium to scrape ...

How to install mysql on centos and set up remote access

1. Download the mysql repo source $ wget http://r...

How MySQL uses transactions

Basics A transaction is an atomic operation on a ...

Nginx memory pool source code analysis

Table of contents Memory Pool Overview 1. nginx d...

MySQL extracts Json internal fields and dumps them as numbers

Table of contents background Problem Analysis 1. ...

WeChat applet uses canvas to draw clocks

This article shares the specific code of using ca...

How to separate static and dynamic state by combining Apache with Tomcat

Experimental environment Apache and Tomcat are bo...

vue+tp5 realizes simple login function

This article example shares the specific code of ...

Detailed explanation of group by and having in MySQL

The GROUP BY syntax can group and count the query...

10 Tips for Mobile App User Interface Design

Tip 1: Stay focused The best mobile apps focus on...

Detailed explanation of the relationship between React and Redux

Table of contents 1. The relationship between red...

Vue implements a simple shopping cart example

This article shares the specific code of Vue to i...

404 error occurs when accessing the homepage of tomcat started in Docker mode

Scenario: When starting tomcat in docker (version...

Implementing password box verification information based on JavaScript

This article example shares the specific code of ...