CSS如何定义表格边框?

html-css010

CSS如何定义表格边框?,第1张

CSS代码:

font-size:

15px

width:

70%

margin:auto

text-align:center

font-size:

15px

border-width:

1

border:1px

solid

#cccccc

注解:border

只定义外围边框,所以table要定义边框,包括内部边框要分别定义

table

td的border试下

table

{border:1px

border-collapse:collapse

}td{

border:1px}

用了JQ库,样式在style里,不过要配合js用

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title></title>

<script src="jquery-3.3.1.min.js"></script>

</head>

<style>

.div1{

text-align: center

background: beige

width: 50px

height: 28px

border-radius: 14px

}

.span1{

/* margin-top: 7px*/ /* div的时候打开注释 */

background: #CCCCCC

width: 13px

height: 13px

display: inline-block

border-radius: 7px

}

.div2{

text-align: center

background: lawngreen

width: 50px

height: 28px

border-radius: 14px

}

.span2{

background: white

width: 13px

height: 13px

display: inline-block

border-radius: 7px

}

.hid1{

display: none

}

.hid2{

}

</style>

<body>

<!-- button的 -->

<button class="div1">

<span class="hid1">是</span>

<span class="span1"></span>

<span class="hid2">否</span>

</button>

<hr>

<hr>

<!-- div的 -->

<!-- <div class="div1">

<span class="hid1">是</span>

<span class="span1"></span>

<span class="hid2">否</span>

</div>-->

</body>

<script>

$(function(){

$(".div1").click(function(){

$(".span1").toggleClass("span2")

$(".div1").toggleClass("div2")

$(".hid1").toggle()

$(".hid2").toggle()

})

})

</script>

</html>