【问题标题】:CSS: increase font-size in mobile responsive just changes line spacingCSS:在移动响应中增加字体大小只是改变行距
【发布时间】:2023-04-09 16:05:01
【问题描述】:

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

【问题讨论】:

  • 对我来说它闻起来像是一个浏览器自动缩放,而不是 CSS。您是否已将 放入您的 中?
  • @AVAVT 不,我没有。我应该吗?
  • 是的,iphone 通常使用更宽的视口和缩小作为实现自然外观的“智能”方式。
  • 这是正确的答案!!谢啦! 已编辑 或谢谢女孩

标签: html css fonts responsive-design


【解决方案1】:

所以@AVAVT 的评论就是答案。问题是浏览器强制常规桌面视图缩放。

对此有两个答案:

  • 视口元数据的 CSS 实现
  • apple 实现的 html 短修复

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-04
    • 2018-12-29
    • 2020-07-23
    • 2020-10-20
    相关资源
    最近更新 更多