2020-05-21
Visual Studio 2019 v16.6.0
WebForm
標黃色是根據結果,有效果的寫法。( 但是有些方是只對某些瀏覽器有效)
標準HTML5語法的checkbox是不支援放大 checkbox 按鈕的語法的
input type=checkbox – checkbox - HTML5
scale() - CSS: Cascading Style Sheets | MDN
Defatult.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication8.Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style>
input.largerCheckbox {
width: 40px;
height: 40px;
}
input.largerCheckbox2 {
transform: scale(2);
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Checkbox1" type="checkbox" />1
<input id="Checkbox2" type="checkbox" style="width: 40px; height: 40px;" />2
<input id="Checkbox2" type="checkbox" width="40" height="40" />2A
<input id="Checkbox3" type="checkbox" class="largerCheckbox" />3
<input id="Checkbox4" type="checkbox" class="largerCheckbox2" />4
<input id="Checkbox4A" type="checkbox" style="transform: scale(2);" />4A
<asp:CheckBox ID="CheckBox5" runat="server" />5
<asp:CheckBox ID="CheckBox6" Width="40px" Height="40px" runat="server" />6
<asp:CheckBox ID="CheckBox7" Style="width: 40px; height: 40px;" runat="server" />7
<asp:CheckBox ID="CheckBox12" style="width: 40px; height: 40px;" runat="server" />7A
<asp:CheckBox ID="CheckBox8" CssClass="largerCheckbox" runat="server" />8
<asp:CheckBox ID="CheckBox9" CssClass="largerCheckbox2" runat="server" />9
<asp:CheckBox ID="CheckBox10" Style="transform: scale(2);" runat="server" />10
<asp:CheckBox ID="CheckBox11" Style="transform: scale(3);" runat="server" />11
</div>
</form>
</body>
</html>
|
IE 11執行結果如下
Chrome 83 執行結果如下
FireFoxChrome 76.0.1 執行結果如下
檢視網頁原始碼
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>
</title>
<style>
input.largerCheckbox {
width: 40px;
height: 40px;
}
|
********************************************************************************
方法2
對 asp:Checkbox 或 input type="checkbox" 在 IE11 或 Chrome 下都有效,對 FireFox 無效。
也可寫成2個檔案
MyCss.cs
(完)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
</title>
<link href="./CSS/MyCss.css" rel="stylesheet" type="text/css">
<style>
.LargeCheckBox input,
.LargeCheckBox2 input {
height: 30px;
width: 30px;
}
</style>
</head>
<body>
<div class="LargeCheckBox">
<input id="C1" type="checkbox" name="ct1">John
<asp:CheckBox ID="CheckBox1" runat="server" />Mary
</div>
</body>
</html> |
也可寫成2個檔案
MyCss.cs
@charset "utf-8"; .Con_OkT input, .Con_OkT2 input { height: 30px; width: 30px; } |
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
</title>
<link href="./CSS/MyCss.css" rel="stylesheet" type="text/css">
<style>
.LargeCheckBox input,
.LargeCheckBox2 input {
height: 30px;
width: 30px;
}
</style>
</head>
<body>
<div class="LargeCheckBox">
<input id="C1" type="checkbox" name="ct1">John
<asp:CheckBox ID="CheckBox1" runat="server" />Mary
</div>
</body>
</html> |



沒有留言:
張貼留言