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

質問編集履歴

1

コードを追加しました

2019/11/26 14:57

投稿

sunred7083
sunred7083

スコア13

title CHANGED
File without changes
body CHANGED
@@ -6,4 +6,183 @@
6
6
  といった感じに書いた後、ブラウザのサイズを縮めたとき(あるいはスマホでサイトを閲覧したとき)に、画像のように右の方にスクロールが出来てしまいます。
7
7
  ![イメージ説明](1b8a2f5fb0acfa2958c6d7c5149918a9.jpeg)
8
8
 
9
- 何か解決策はないでしょうか。
9
+ 何か解決策はないでしょうか。
10
+
11
+ 練習用ですがコードを追記しました。
12
+
13
+ ```HTML
14
+ <DOCTYPE html>
15
+ <html lang="ja">
16
+ <head>
17
+ <meta charset="UTF-8">
18
+ <title>練習</title>
19
+ <link rel="stylesheet" href="css/reset.css">
20
+ <link rel="stylesheet" href="css/slicknav.min.css">
21
+ <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.4/css/all.css">
22
+ <link rel="stylesheet" href="css/style.css">
23
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
24
+ </head>
25
+
26
+ <body>
27
+ <header>
28
+ <a href="index.html"><img src="images/headertest.jpg"></a>
29
+ </header>
30
+
31
+ <nav>
32
+ <ul id="menu">
33
+ <li><a href="index.html">Top</a></li>
34
+ <li><a href="#">Introduction</a></li>
35
+ <li><a href="#">Menu</a></li>
36
+ <li><a href="#">Contact</a></li>
37
+ </ul>
38
+ </nav>
39
+
40
+ <article>
41
+ <h1>ああああ</h1>
42
+ </article>
43
+
44
+ <aside>
45
+ <h1>いいいい</h1>
46
+ <img src="images/headertest.jpg">
47
+ <img src="images/bannertext.jpg">
48
+ </aside>
49
+
50
+ <footer>
51
+ <p>うううう</p>
52
+ </footer>
53
+
54
+ <script src="js/jquery-3.4.1.min.js"></script>
55
+ <script src="js/jquery.slicknav.min.js"></script>
56
+ <script src="js/script.js"></script>
57
+ </body>
58
+ </html>
59
+ </DOCTYPE>
60
+ ```
61
+
62
+ ```CSS
63
+ @charset "utf-8";
64
+
65
+ body {
66
+ background-color: white;
67
+ width: 960px;
68
+ margin: 0 auto 0 auto;
69
+ }
70
+
71
+ /* ヘッダー */
72
+ header {
73
+ width: 960px;
74
+ background-color: antiquewhite;
75
+ }
76
+ header img {
77
+ }
78
+ @media screen and (max-width: 750px) {
79
+ header img {
80
+ width: 0;
81
+ height: 0;
82
+ }
83
+ }
84
+
85
+ /* ナビゲーションエリアの設定 */
86
+ nav {
87
+ text-align: center;
88
+ width: 960px;
89
+ background-color: azure;
90
+ }
91
+ nav ul li {
92
+ list-style: none;
93
+ display: inline-block;
94
+ }
95
+ nav ul li a {
96
+ text-align: center;
97
+ text-decoration: none;
98
+ width: 130px;
99
+ line-height: 70px;
100
+ overflow: hidden;
101
+ font-size: 24px;
102
+ font-weight:bold;
103
+ color: black;
104
+ background-color: aqua;
105
+ }
106
+ #menu {
107
+ display: none;
108
+ }
109
+ nav ul li a:hover {
110
+ background-color: black;
111
+ color: white;
112
+ }
113
+
114
+ @media screen and (min-width: 750px) {
115
+ #menu {
116
+ display: block;
117
+ }
118
+ .slicknav_menu {
119
+ display: none;
120
+ }
121
+ }
122
+ .slicknav_menu:before {
123
+ width: 180px;
124
+ height: 50px;
125
+ float: left;
126
+ background-image: ;
127
+ background-repeat: no-repeat;
128
+ background-position: center left;
129
+ background-size: 100%;
130
+ content: "";
131
+ margin: 0 0 0 19px;
132
+ }
133
+ .slicknav_menu {
134
+ width: 100%;
135
+ position:absolute;
136
+ top: 0;
137
+ width: 100%;
138
+ z-index: 10000;
139
+ background-color: #280000;
140
+ }
141
+
142
+ /* 本文 */
143
+ article {
144
+ width: 760px;
145
+ background-color: beige;
146
+ padding: 0 0 1000px 0;
147
+ float: left;
148
+ }
149
+ article h1 {
150
+ font-size: 100px;
151
+ }
152
+ @media screen and (max-width: 750px) {
153
+ article {
154
+ width: 100%;
155
+ margin: 60px 0 0 0;
156
+ }
157
+ }
158
+
159
+ /* aside */
160
+ aside {
161
+ width: 200px;
162
+ background-color: blanchedalmond;
163
+ margin: 0;
164
+ float: right;
165
+ }
166
+ aside img {
167
+ display: inline-block;
168
+ width: 200px;
169
+ }
170
+ @media screen and (max-width: 750px) {
171
+ aside {
172
+ width: 100%;
173
+ }
174
+ aside img {
175
+ width: 27%;
176
+ }
177
+
178
+ /* footer */
179
+ footer {
180
+ clear: both;
181
+ width: 960px;
182
+ background-color: chartreuse;
183
+ }
184
+ footer p {
185
+ font-size: 30px;
186
+ }
187
+
188
+ ```