css圆在中心根据宽度缩放

Introduction:

介绍:

Dealing with fonts is a very interesting thing to do as fonts bring out the appearance of your website or a web page so you must choose the ideal fonts for your website or web page that helps in making your website or web page look amazing. But sometimes fonts can also pose many problems like rescaling which brings us to the topic at hand, rescaling the font based on the container width in CSS. The problem is very easy to solve but before we move further with the solution let us talk about fonts a little bit more.

处理字体是一件非常有趣的事情,因为字体会带出网站或网页的外观,因此您必须为网站或网页选择理想的字体,这有助于使网站或网页看起来很棒。 但是有时字体也可能带来许多问题,例如重新缩放,这使我们进入了当前的话题, 根据CSS中的容器宽度重新缩放字体 。 这个问题很容易解决,但是在我们进一步解决之前,让我们先谈谈字体。

Trivia:

琐事:

Fonts, as said earlier, are used regularly while developing a website or a web page. So, you must be very careful while selecting the primary font for your website or web page because fonts would define how your texts are gonna look like to the users and as you are aware the texts are the most fundamental elements of any website or web page. You can choose from an array of fonts available, just preview your website or web page first while making the selection for a font. The appearance is not only dependent on the right font style but also the size of the font. You don’t want your website or web page to appear shabby, therefore you must have a uniform-sized font for your web page or website. Now let us discuss how can we rescale our font based on container width in CSS and for you will need to read a bit more.

如前所述,在开发网站或网页时经常使用字体。 因此,在选择网站或网页的主要字体时必须非常小心,因为字体会定义文本对用户的外观,并且您知道文本是任何网站或网页的最基本元素。 您可以从可用的字体数组中进行选择,只是在选择字体时先预览您的网站或网页。 外观不仅取决于正确的字体样式,而且还取决于字体的大小。 您不希望您的网站或网页显得破旧,因此您必须为网页或网站使用统一大小的字体。 现在让我们讨论如何根据CSS中的容器宽度重新调整字体,因为您将需要内容。

Method:

方法:

To set the font size, you can make use of viewport "VW" unit which is also known as viewport width. The viewport is the size of your window browser and 1vw = 1% of the viewport width. By making use of this property your font size will be by the browser window size.

要设置字体大小,可以使用视口“ VW”单位,也称为视口宽度。 视口是窗口浏览器的大小,并且1vw =视口宽度的1% 。 通过使用此属性,您的字体大小将取决于浏览器窗口的大小。

Syntax:

句法:

    element{
font-size:length vw;
}

Example:

例:

<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
<style>
h1 {font-size: 5vw;
}
</style>
</head>
<body>
<h1>Rescale font based on container width in CSS</h1>
<center>
<img src="img_forest.jpg" width="240" height="184">
</center>
<p>
By making use of this property your font size will be in
accordance with the browser window size.</p>
</body>
</html>

Output

输出量

In the above example, font-size vw is applied to the content inside the h1 tag.

在上面的示例中,将font-size vw应用于h1标签内的内容。

Be wise:

聪明点:

Easy right? All you had to do was make use of Viewport property that would help in resizing the font according to the browser window. So go ahead and start resizing your font size and start making your website or webpage stylish and ready to deploy. Make sure that you choose the appropriate font for your website or webpage as this property will change the size of your font according to the browser window, therefore, choose wisely.

容易吧? 您所要做的就是利用Viewport属性,该属性将有助于根据浏览器窗口调整字体大小。 因此,开始调整字体大小,开始使您的网站或网页外观时尚并可以部署。 确保为网站或网页选择合适的字体,因为此属性将根据浏览器窗口更改字体大小,因此,请明智选择。

翻译自: https://www.includehelp.com/code-snippets/rescale-font-based-on-container-width-in-css.aspx

css圆在中心根据宽度缩放

css圆在中心根据宽度缩放_根据CSS中的容器宽度重新缩放字体相关推荐

  1. css表格文字超数量就竖排_利用CSS如何实现文字的竖排

    本篇文章给大家带来的内容是关于利用CSS如何实现文字的竖排,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 样式表的文字处理属性中有两个重要的属性:writing-mode和text- ...

  2. css怎么让两个table并排_关于CSS布局

    水平居中 水平居中可能是CSS布局中最常用到的布局,这里介绍几种水平居中的方式 1.使用inline-block 和 text-align实现 .parent{text-align: center;} ...

  3. css如何把图片设置为黑白_使用CSS将图像转换为黑白图像

    css如何把图片设置为黑白 Desaturating a color image couldn't be simpler with CSS. The filter is typically appli ...

  4. c# 计算空格宽度像素_关于C#中换算像素和毫米的说明

    在C#中是以像素作为尺寸单位的,像素是一种相对的尺寸概念,与毫米的转换跟当前显示器的分辨率有关,在不同分辨率下转换的系数也不同. 借助C#中的GDI可以实现像素与毫米的换算: 一.根据Win32 AP ...

  5. svg 缩放_研究:可缩放矢量图形(SVG)

    矢量图形已广泛应用于印刷媒体中 . 在网站中,我们还可以使用SVG或可缩放矢量图形添加矢量图形. 根据W3.org的官方规范 ,SVG被描述为: 一种用于描述XML中的二维图形的语言. SVG支持三种 ...

  6. css 绘制三角形_解释CSS形状:如何使用纯CSS绘制圆,三角形等

    css 绘制三角形 Before we start. If you want more free content but in video format. Don't miss out on my Y ...

  7. hssfworkbook 设置自适应宽度_「CSS很简单」CSS 实现宽高等比自适应容器

    在最近开发移动端页面,遇到这么一个情况:当页面宽度 100% 时,高度为宽度一半,并随手机宽度变化依然是一半. 于是我们就需要实现一个宽度自适应,高度为宽度一半的容器. 这里先以高度为宽度一半为例,也 ...

  8. css 菜单栏悬停_在CSS中构建悬停菜单

    css 菜单栏悬停 A good menu design is an important part of any website or web app UI. Using only modern HT ...

  9. css覆盖规则_条件 CSS

    在CSS的世界中,总是有很多实验性的属性先行,正因为这些先行者在不断的探索新的特性,才让CSS越来越强大.而这些实验性的特性并没有立马得到众多浏览器的支持,为了能让这些实验性特性能在部分支持的浏览器上 ...

最新文章

  1. donsker定理_中心极限定理和Donsker定理
  2. Pdf怎么转换excel表格,职场人士必备技能
  3. 【Linux】一步一步学Linux——Linux版本(03)
  4. Linux进程的创建函数fork()及其fork内核实现解析
  5. 面试题目_经典面试题目「回溯算法」解数独
  6. android 1396x750设计图,移动端的适配|切图|标注
  7. left join 多条件_第九篇|Spark的五种JOIN策略解析
  8. 工作一年了,从新拾起写博客的道路
  9. mysql数据库配置优化(占cpu过高问题)
  10. lintcode:线段树的构造
  11. clean code
  12. sshj ,ssh , springmvc pom.xml
  13. 两年前端历程回顾的思考与总结
  14. 【技术分享】配置手工模式链路聚合(交换机之间直连)
  15. vfp python_Visual Fox Pro和Python
  16. html 模拟鼠标移动,如何在网页端用js模拟鼠标移动点击等操作
  17. Prometheus邮件报警设置
  18. 乐趣国学—品读“富润屋,德润身。”中的智慧
  19. widget安卓桌面插件初步使用
  20. 分享个神途游戏的辅助脚本,这类传奇手游能用的挂机工具

热门文章

  1. 隔行变色java代码_jquery入门—选择器实现隔行变色实例代码
  2. html页面怎么加向下滚动,如何使用jQuery向上或向下滚动页面到锚点?
  3. 简单的签到代码_PHP实现一个小小的签到功能,到底用MySQL还是Redis?
  4. mysql安装、导入数据脚本
  5. go validator使用教程
  6. python(33)多进程和多线程的区别
  7. 微软职位内部推荐-Principal Group Program Manager
  8. 错误:readline/readline.h:没有那个文件或目录解决方法
  9. Log4j的应用实例
  10. Oracle 11g数据库管理与开发指南