Home Web Front-end JS Tutorial How to implement table merge cells in Bootstrap

How to implement table merge cells in Bootstrap

Jun 07, 2018 pm 02:41 PM
bootstrap Merge Cells sheet

This article mainly introduces the table merging cells implemented by Bootstrap, involving operating skills related to the bootstrap interface layout. Friends in need can refer to the following

The example of this article describes the table merging cells implemented by Bootstrap. Share it with everyone for your reference, the details are as follows:

1. Problem background

Use Bootstrap to design the table, and the table needs to merge cells

2. Implementation source code

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="description" content="">

    <meta name="author" content="">

    <title>Bootstrap-表格合并单元格</title>

    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.css" rel="external nofollow" />

    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>

    <script type="text/javascript" src="https://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.js" ></script>

    <style>

      body,html{

        width: 99%;

        height: 98%;

        font-family: "微软雅黑";

        font-size: 14px;

      }

      table{

        width: 100%;

      }

    </style>

    <script>

    </script>

  </head>

  <body>

    <p class="row">

      <p class="col-xs-12">

        <table class="table table-striped">

          <tr>

            <td>

              <label for="stuNo">学号:</label>

              <input type="text" id="stuNo" />

              <p class="btn-group" style="width: 157px; height: 26px;">

                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" style="width: 157px; height: 26px;">

                  班级

                </button>

                <ul class="dropdown-menu" role="menu">

                 <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >一班</a></li>

                 <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >二班</a></li>

                 <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >三班</a></li>

                 <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >四班</a></li>

                 <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >五班</a></li>

                </ul>

              </p>

              <button type="button" class="btn btn-primary">查询</button>

              <button type="button" class="btn">重置</button>

            </td>

          </tr>

        </table>

      </p>

      <p class="col-xs-12">

        <p class="col-xs-2">

          <table class="table table-striped table-bordered">

            <caption>学生表</caption>

            <thead>

              <tr>

                <th>学生</th>

                <th>学号</th>

              </tr>

            </thead>

            <tbody>

              <tr>

                <td>胡思</td>

                <td>2016010101</td>

              </tr>

              <tr>

                <td>赵四</td>

                <td>2016010102</td>

              </tr>

              <tr>

                <td>陈诚</td>

                <td>2016010103</td>

              </tr>

              <tr>

                <td>李磊</td>

                <td>2016010104</td>

              </tr>

              <tr>

                <td>孙杨</td>

                <td>2016010105</td>

              </tr>

              <tr>

                <td>李爽</td>

                <td>2016010106</td>

              </tr>

            </tbody>

          </table>

          <table class="table table-striped table-bordered">

            <caption>学生表</caption>

            <thead>

              <tr>

                <th>学生</th>

                <th>学号</th>

              </tr>

            </thead>

            <tbody>

              <tr>

                <td>胡思</td>

                <td>2016010101</td>

              </tr>

              <tr>

                <td>赵四</td>

                <td>2016010102</td>

              </tr>

              <tr>

                <td>陈诚</td>

                <td>2016010103</td>

              </tr>

              <tr>

                <td>李磊</td>

                <td>2016010104</td>

              </tr>

              <tr>

                <td>游豪</td>

                <td>2016010105</td>

              </tr>

            </tbody>

          </table>

        </p>

        <p class="col-xs-10">

          <table class="table table-striped">

            <tr style="text-align: center;">

              <td>到校</td>

              <td>回家</td>

              <td>距离</td>

            </tr>

            <tr style="text-align: center;">

              <td colspan="2" style="text-align: center;">222</td>

              <td rowspan="2" style="width: 200px;">

                <p class="col-xs-12">

                  <table class="table table-striped table-bordered">

                    <thead>

                      <tr>

                        <th>姓名</th>

                        <th>学号</th>

                      </tr>

                    </thead>

                    <tbody>

                      <tr>

                        <td>胡思</td>

                        <td>2016010101</td>

                      </tr>

                    </tbody>

                  </table>

                </p>

              </td>

            </tr>

            <tr>

              <td colspan="2" style="text-align: center;">333</td>

            </tr>

          </table>

          <table class="table table-striped">

            <tr style="text-align: center;">

              <td>到校</td>

              <td>回家</td>

              <td>距离</td>

            </tr>

            <tr style="text-align: center;">

              <td colspan="2" style="text-align: center;">222</td>

              <td rowspan="2" style="width: 200px;">

                <p class="col-xs-12">

                  <table class="table table-striped table-bordered">

                    <thead>

                      <tr>

                        <th>姓名</th>

                        <th>学号</th>

                      </tr>

                    </thead>

                    <tbody>

                      <tr>

                        <td>胡思</td>

                        <td>2016010101</td>

                      </tr>

                    </tbody>

                  </table>

                </p>

              </td>

            </tr>

            <tr>

              <td colspan="2" style="text-align: center;">333</td>

            </tr>

          </table>

          <table class="table table-striped">

            <tr style="text-align: center;">

              <td>到校</td>

              <td>回家</td>

              <td>距离</td>

            </tr>

            <tr style="text-align: center;">

              <td colspan="2" style="text-align: center;">222</td>

              <td rowspan="2" style="width: 200px;">

                <p class="col-xs-12">

                  <table class="table table-striped table-bordered">

                    <thead>

                      <tr>

                        <th>姓名</th>

                        <th>学号</th>

                      </tr>

                    </thead>

                    <tbody>

                      <tr>

                        <td>胡思</td>

                        <td>2016010101</td>

                      </tr>

                    </tbody>

                  </table>

                </p>

              </td>

            </tr>

            <tr>

              <td colspan="2" style="text-align: center;">333</td>

            </tr>

          </table>

          <table class="table table-striped">

            <tr style="text-align: center;">

              <td>到校</td>

              <td>回家</td>

              <td>距离</td>

            </tr>

            <tr style="text-align: center;">

              <td colspan="2" style="text-align: center;">222</td>

              <td rowspan="2" style="width: 200px;">

                <p class="col-xs-12">

                  <table class="table table-striped table-bordered">

                    <thead>

                      <tr>

                        <th>姓名</th>

                        <th>学号</th>

                      </tr>

                    </thead>

                    <tbody>

                      <tr>

                        <td>胡思</td>

                        <td>2016010101</td>

                      </tr>

                    </tbody>

                  </table>

                </p>

              </td>

            </tr>

            <tr>

              <td colspan="2" style="text-align: center;">333</td>

            </tr>

          </table>

        </p>

      </p>

    </p>

  </body>

</html>

Copy after login

3. Implementation result

The above is what I compiled for everyone. I hope It will be helpful to everyone in the future.

Related articles:

How to use Lodash method in Angular?

vue-router project actual combat (detailed tutorial)

Detailed answer to JS operation clipboard

The above is the detailed content of How to implement table merge cells in Bootstrap. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1661
14
PHP Tutorial
1261
29
C# Tutorial
1234
24
How to get the bootstrap search bar How to get the bootstrap search bar Apr 07, 2025 pm 03:33 PM

How to use Bootstrap to get the value of the search bar: Determines the ID or name of the search bar. Use JavaScript to get DOM elements. Gets the value of the element. Perform the required actions.

How to use bootstrap in vue How to use bootstrap in vue Apr 07, 2025 pm 11:33 PM

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

How to do vertical centering of bootstrap How to do vertical centering of bootstrap Apr 07, 2025 pm 03:21 PM

Use Bootstrap to implement vertical centering: flexbox method: Use the d-flex, justify-content-center, and align-items-center classes to place elements in the flexbox container. align-items-center class method: For browsers that do not support flexbox, use the align-items-center class, provided that the parent element has a defined height.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

How to use bootstrap button How to use bootstrap button Apr 07, 2025 pm 03:09 PM

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

See all articles