css解決ios端按鈕和輸入框自帶圓角的問題

請在這裏查看示例 borderRadius示例

問題重現

在ios端,我們不想使用按鈕或輸入框自帶的圓角樣式,改如何取消呢?

問題解決

  • -webkit-appearance : none ;/解決ios上按鈕的圓角問題/
  • border-radius: 0;/解決ios上輸入框圓角問題/
  • ios端示例截屏如下:
    這裏寫圖片描述

示例源碼

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title>demo</title>
<style>
    * {  
        margin: 0;   
        padding: 0;  
    }  
    body, html {  
        width: 100%;  
        height: 100%;
    }
    button, input {
        width: 90%;
        margin: 0 auto;
        display: block;
        box-sizing: border-box;
        height: 50px;
        line-height: 50px;
    }
    .bBtn {
        -webkit-appearance : none ;/*解決ios上按鈕的圓角問題*/
    }
    .bInput {
        border-radius: 0;/*解決ios上輸入框圓角問題*/
    }
</style>
</head>
<body>
    <button class="aBtn">ios這個按鈕有圓角</button>
    <button class="bBtn">ios這個按鈕沒有圓角</button>
    <input class="aInput" type="text" placeholder="ios這個輸入框有圓角"/>
    <input class="bInput" type="text" placeholder="ios這個輸入框沒有圓角"/>
</body>
</html>
發佈了221 篇原創文章 · 獲贊 155 · 訪問量 71萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章