2021-01-25面试题

2021-01-25  本文已影响0人  Viewwei

label都有哪些作用?并举相应的例子说明

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <input type="button" id="btn" />
        <label for="btn">Button</label>
    </body>
    <style>
        input[type='button'] {
          display: none;
        }
        label {
          display: inline-block;
          padding: 10px 20px;
          background: #456;
          color: #fff;
          cursor: pointer;
          box-shadow: 2px 2px 4px 0 rgba(0,0,0,.3);
          border-radius: 2px;
        }
    </style>
</html>

<input type="checkbox" id="controller">
<label class="icon" for="controller">
  <div class="play"></div>
  <div class="pause"></div>
</label>
<div class="animation"></div>

<style>
...
#controller:checked ~ .animation {
  animation-play-state: paused;
}
...
</style>

用css创建一个三角形,并简述原理

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
            <div class='rect'></div>
    </body>

    <style>
        .rect {
           width: 0;
               height: 0;
               background-color: #fff;
               border-right: 100px solid transparent;
               border-left: 100px solid transparent;
               border-top: 100px solid rgb(29, 156, 194);
               border-bottom: 100px solid transparent
        }
      </style>
</html>

image.png

写一个去除制表符和换行符的方法

 <script>
          function getData(target){
            return target.replace(/\t|\n|\r/g,"")
          }
      </script>
上一篇 下一篇

猜你喜欢

热点阅读