我在 patife.com 创建了一个小型博客应用
默认的 CSS 行为是移动页面。我想要更大的字体(无处不在),以便它在移动设备上更具可读性,并在大型显示格式上使用更小的字体。但是在代码中的任何地方我插入一个不同的“字体大小:xx rem”,我的 iPhone 上显示的字体保持相同的大小,只是行间距被压缩或扩展。
同样,我想要的是: - 移动(默认)行为:字体大小显示大 - 大屏幕行为:字体大小显示正常(1rem)
下面没有任何字体大小的当前代码
html {
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
ul {
margin-left:20px;
}
ol {
margin-left:20px;
}
/* Obsessive compulsive behaviour: Nobody touch the borders! */
.page {
line-height: 1.4rem;
margin: 30px 30px 30px 30px;
}
/* MAIN STRUCTURE */
/* This is an ID because we only use it once and specifically*/
#header {
width: 100%;
z-index: 1;
display: inline-block;
}
#title {
float: left;
}
/* inside the header */
#meta {
float: right;
}
/* This is a class because it will be used multiple times (2) */
.column {
margin-top: 15px;
display: inline-block;
}
/* first column */
#entries {
float: left;
width: 100%;
}
/* second column */
#navigation {
display: inline-block;
float: left;
background-color: beige;
width: 100%;
text-align: left;
}
/* ENTRIES */
.entry {
display: block;
margin-bottom: 20px;
}
.entry_title{
font-weight: bold;
}
.entry_body{
}
.en {
float: left;
width: 100%;
margin-bottom: 10px;
margin-right: 0px;
}
.pt {
float: left;
width: 100%;
margin-left: 0px;
font-style: italic;
}
p {
margin-top: 1.4rem;
}
.entry_category{
}
.entry_footer{
width: 100%;
clear: both;
color: lightgrey;
}
/* FORMS */
.form_title{
float: left;
width: 100%;
}
.form_field{
float: left;
width: 100%;
}
.form_input_big{
width: 100%;
height: 30rem;
}
.form_button{
display: block;
}
/* TEXT */
#title a {
color: rgb(38, 38, 38);
}
a:link {
text-decoration: none;
}
a:hover{
text-decoration: underline;
}
a:visited{
text-decoration: underline;
color: blue;
}
.flash{
color: red;
}
@media (min-width: 63em) {
.en {
width: calc(48% - 15px);
margin-bottom: 0px;
margin-right: calc(15px + 2%);
}
.pt {
width: calc(48% - 15px);
margin-left: calc(15px + 2%);
}
}
最佳答案
@AVAVT 的评论就是答案。问题是浏览器强制执行常规桌面 View 缩放。
对此有两个答案:
- 视口(viewport)元的 CSS 实现
- apple 实现的 html short-fix
来自 http://webdesign.tutsplus.com/articles/quick-tip-dont-forget-the-viewport-meta-tag--webdesign-5972
关于html - CSS:在移动响应中增加字体大小只会改变行间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35947383/