简体   繁体   English

CSS:在移动响应中增加字体大小只会更改行距

[英]CSS: increase font-size in mobile responsive just changes line spacing

I created a small blog app at patife.com 我在patife.com创建了一个小型博客应用

The default CSS behaviour is the mobile page. CSS的默认行为是移动页面。 I want to have bigger fonts (everywhere) so that its more readable on mobile, and smaller fonts on the large display format. 我希望每个地方都有更大的字体,以便在移动设备上更易读,在大尺寸显示格式上,字体更小。 But wherever in the code i insert a different "font-size: xx rem", the font displayed on my iPhone remains the same size, just the line spacings get compressed or extended. 但是无论我在代码中的任何地方插入不同的“ font-size:xx rem”,iPhone上显示的字体都保持相同大小,只是行距被压缩或扩展。

Again, what i want is: - mobile (default) behaviour: font size displays big - large screen behaviour: font size displays normal (1rem) 同样,我想要的是:-移动(默认)行为:字体大小显示大-大屏幕行为:字体大小显示正常(1rem)

Current code without any font-sizes below 当前代码,下面没有任何字体大小

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%);
    }
}

So the comment from @AVAVT was the answer. 因此,@ AVAVT的评论就是答案。 The problem is that the browser was forcing the regular desktop view zoom. 问题在于浏览器正在强制常规桌面视图缩放。

There's two answers for this: 有两个答案:

  • a CSS implementation of the viewport meta 视口meta的CSS实现
  • the html short-fix implemented by apple 苹果实现的html短代码

from http://webdesign.tutsplus.com/articles/quick-tip-dont-forget-the-viewport-meta-tag--webdesign-5972 来自http://webdesign.tutsplus.com/articles/quick-tip-dont-forget-the-viewport-meta-tag--webdesign-5972

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM