teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

追記

2018/05/15 19:58

投稿

s8_chu
s8_chu

スコア14731

answer CHANGED
@@ -68,4 +68,168 @@
68
68
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
69
69
  </body>
70
70
  </html>
71
+ ```
72
+
73
+ # 追記
74
+ コメント欄の②は、以下のように行うことができると思いますが、いかがでしょうか?
75
+ ```HTML
76
+ <!DOCTYPE html>
77
+ <html lang="ja">
78
+ <head>
79
+ <meta charset="utf-8">
80
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
81
+ <meta name="viewport" content="width=device-width, initial-scale=1">
82
+ <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
83
+ <title>入力</title>
84
+ <style>
85
+ .nav {
86
+ display: flex;
87
+ width: 100%;
88
+ flex-wrap: wrap;
89
+ }
90
+
91
+ .navbar-nav {
92
+ margin: 0;
93
+ }
94
+
95
+ .navbar-nav > li {
96
+ flex: 0 1 33.3%;
97
+ }
98
+
99
+ .navbar-nav > li > a {
100
+ padding-top: 15px;
101
+ padding-bottom: 15px;
102
+ }
103
+ </style>
104
+ </head>
105
+ <body style="padding-top: 100px;">
106
+ <div class="sitewrapper container-fluid">
107
+ <nav class="navbar navbar-default navbar-fixed-top">
108
+ <div class="navbar-header"></div>
109
+ <ul class="nav navbar-nav">
110
+ <li class="active"><a href="#test1" data-toggle="pill">テスト1</a></li>
111
+ <li><a href="#test2" data-toggle="pill">テスト2</a></li>
112
+ <li><a href="#test3" data-toggle="pill">テスト3</a></li>
113
+ <li><a href="#test4" data-toggle="pill">テスト4</a></li>
114
+ <li>
115
+ <button type="button" class="btn btn-primary navbar-btn">送信</button>
116
+ </li>
117
+ </ul>
118
+ </nav>
119
+ <h2 class="page-header">入力</h2>
120
+ <form name="form" id="form" class="" action="commit" method="post">
121
+ <div class="tab-content">
122
+ <div class="tab-pane active" id="test1">
123
+ a<BR>
124
+ a<BR>
125
+ a<BR>
126
+ </div>
127
+ <div class="tab-pane" id="test2">
128
+ b<BR>
129
+ b<BR>
130
+ b<BR>
131
+ </div>
132
+ <div class="tab-pane" id="test3">
133
+ c<BR>
134
+ c<BR>
135
+ c<BR>
136
+ </div>
137
+ <div class="tab-pane" id="test4">
138
+ d<BR>
139
+ d<BR>
140
+ d<BR>
141
+ </div>
142
+ </div>
143
+ </form>
144
+ </div>
145
+ <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
146
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
147
+ </body>
148
+ </html>
149
+ ```
150
+
151
+ もしくは、`CSS Grid Layout`を使うことでも可能だと思います。
152
+ ```HTML
153
+ <!DOCTYPE html>
154
+ <html lang="ja">
155
+ <head>
156
+ <meta charset="utf-8">
157
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
158
+ <meta name="viewport" content="width=device-width, initial-scale=1">
159
+ <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
160
+ <title>入力</title>
161
+ <style>
162
+ :root {
163
+ --gridHeight: 50px;
164
+ }
165
+
166
+ body {
167
+ padding-top: calc(var(--gridHeight) * 2);
168
+ }
169
+
170
+ .nav::before, .nav::after {
171
+ content: none;
172
+ }
173
+
174
+ .nav {
175
+ display: grid;
176
+ width: 100%;
177
+ grid-template-rows: repeat(auto-fill, var(--gridHeight));
178
+ grid-template-columns: repeat(3, minmax(80px, 1fr));
179
+ }
180
+
181
+ .navbar-nav {
182
+ margin: 0;
183
+ }
184
+
185
+ .navbar-nav > li > a {
186
+ padding-top: 15px;
187
+ padding-bottom: 15px;
188
+ }
189
+ </style>
190
+ </head>
191
+ <body>
192
+ <div class="sitewrapper container-fluid">
193
+ <nav class="navbar navbar-default navbar-fixed-top">
194
+ <div class="navbar-header"></div>
195
+ <ul class="nav navbar-nav">
196
+ <li class="active"><a href="#test1" data-toggle="pill">テスト1</a></li>
197
+ <li><a href="#test2" data-toggle="pill">テスト2</a></li>
198
+ <li><a href="#test3" data-toggle="pill">テスト3</a></li>
199
+ <li><a href="#test4" data-toggle="pill">テスト4</a></li>
200
+ <li>
201
+ <button type="button" class="btn btn-primary navbar-btn">送信</button>
202
+ </li>
203
+ </ul>
204
+ </nav>
205
+ <h2 class="page-header">入力</h2>
206
+ <form name="form" id="form" class="" action="commit" method="post">
207
+ <div class="tab-content">
208
+ <div class="tab-pane active" id="test1">
209
+ a<BR>
210
+ a<BR>
211
+ a<BR>
212
+ </div>
213
+ <div class="tab-pane" id="test2">
214
+ b<BR>
215
+ b<BR>
216
+ b<BR>
217
+ </div>
218
+ <div class="tab-pane" id="test3">
219
+ c<BR>
220
+ c<BR>
221
+ c<BR>
222
+ </div>
223
+ <div class="tab-pane" id="test4">
224
+ d<BR>
225
+ d<BR>
226
+ d<BR>
227
+ </div>
228
+ </div>
229
+ </form>
230
+ </div>
231
+ <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
232
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
233
+ </body>
234
+ </html>
71
235
  ```