改变 <h1> 的大小响应引导时的标记

2023-08-01前端开发问题
9

本文介绍了改变 <h1> 的大小响应引导时的标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

<h1>标签在超小或小屏幕尺寸下,有什么办法可以改变它的文本大小吗?

Is there any way to change the text size of <h1> tag when it goes on extra small or small screen size?

因为 <h1> 有自己的默认尺寸,对于中号来说是正常的,但对于小号和超小号来说非常大.

Because <h1> has its own default size which is normal for medium size but very large for small and extra small.

当它变为小屏幕尺寸或超小屏幕尺寸时,我想更改该尺寸.

I want to change that size when it goes to small screen size or extra small screen size.

推荐答案

您可以创建一个自定义的 .css 文件(例如:site.css),然后使用 @media 在不同的屏幕尺寸.要在引导程序中覆盖 h1 类,您必须在引导程序之后包含您的自定义 css.下面是site.cssh1的例子:

You can create a custom .css file (for example: site.css) and then use @media to create different behavior on different screen size. To override the h1 class in bootstrap, you have to include your custom css after the bootstrap. Below is the example of h1 in site.css:

h1 {
  /* Extra small devices (phones, less than 768px) */
  font-size: 10px;

  /* Small devices (tablets, 768px and up) */
  @media (min-width: 768px) {
    font-size: 12px;
  }

  /* Medium devices (desktops, 992px and up) */
  @media (min-width: 992px) {
    font-size: 16px;
  }

  /* Large devices (large desktops, 1200px and up) */
  @media (min-width: 1200px) {
    font-size: 18px;
  }
}

这是bootstrap目前使用的@media规则,官方文档见这里.

This is the @media rules which bootstrap currently use, the official docs can be seen in here.

这篇关于改变 &lt;h1&gt; 的大小响应引导时的标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

layui 单选框、复选框、下拉菜单不显示问题如何解决?
1. 如果是ajax嵌套了 页面, 请确保 只有最外层的页面引入了layui.css 和 layui.js ,内层页面 切记不要再次引入 2. 具体代码如下 layui.use(['form', 'upload'], function(){ var form = layui.form; form.render(); // 加入这一句});...
2024-11-09 前端开发问题
313

layui要如何改变时间日历布局大小?
问题描述 我想改变layui时间日历布局大小,这个要怎么操作呢? 解决办法 可以用css样式对时间日历进行重新布局,具体代码如下: !DOCTYPE htmlhtmlheadmeta charset="UTF-8"title/titlelink rel="stylesheet" href="../../layui/css/layui.css" /style#test-...
2024-10-24 前端开发问题
271

缩放背景图像以适合 ie8 窗口
Scale background image to fit ie8 window(缩放背景图像以适合 ie8 窗口)...
2024-04-19 前端开发问题
11

IE7 (IETEster) 中的@fontface 无法正常工作
@fontface in IE7 (IETEster) not working properly(IE7 (IETEster) 中的@fontface 无法正常工作)...
2024-04-19 前端开发问题
9

Safari 5.1 打破 CSS 表格单元格间距
Safari 5.1 breaks CSS table cell spacing(Safari 5.1 打破 CSS 表格单元格间距)...
2024-04-19 前端开发问题
3

如何使用 `on()` 委托 `hover()` 函数
How to delegate `hover()` function by using `on()`(如何使用 `on()` 委托 `hover()` 函数)...
2024-04-19 前端开发问题
17