【发布时间】:2020-08-14 07:47:30
【问题描述】:
我最近推出了这个网站。在移动视图中,标题不会覆盖整个屏幕宽度,而是在右侧有一个边距。我找不到让它同时在桌面和移动设备上运行的解决方案。
这是视口设置
<meta name="viewport" content="width=device-width, initial-scale=1">
网址是camisite.now.sh
这是我的 CSS,对象只是一个没有类的标题。 我尝试更改为 100vw,但大致相同。我认为 viewport-width 可能设置了错误的宽度。
@font-face{
font-family: songenia;
src:url("songenia.otf")
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
color: cornsilk;
}
body {
font-family: songenia;
font-size: xx-large;
background-image: url(background.jpg);
line-height: 1.2;
}
.input{
line-height: 1.6;
margin-top: 30px;
}
.posts {
list-style: none;
}
.onepost {
padding: 10px;
background: rgba(215, 177, 88, 0.548);
margin: 30px 0;
}
header {
background: rgba(215, 177, 88, 0.548);
padding: 2rem;
min-width: 100%;
text-align: center;
}
h1, h4 {
text-align: center;
}
.error-message {
text-align: center;
}
.input {
margin-top: 30px;
font-size: large;
}
main {
margin: auto;
width: 500px;
overflow: auto;
padding: 3rem 2rem;
}
.post-form {
padding: 2rem;
background:rgba(215, 177, 88, 0.548);
}
.post-form label {
text-align: center;
display: block;
}
.post-form input[type='text'] {
width: 100%;
padding: 8px;
margin-bottom: 10px;
border-radius: 5px;
color: black;
border: 1px solid #ccc;
}
.btn {
display: block;
width: 100%;
padding: 10px 15px;
border: 0;
background:rgba(25, 17, 68, 0.644);
color: #fff;
border-radius: 5px;
margin: 5px 0;
}
.btn:hover {
background: rgba(215, 177, 88, 0.548);
}
【问题讨论】:
标签: html css responsive-design responsive viewport