css圆在中心根据宽度缩放_根据CSS中的容器宽度重新缩放字体
css圓在中心根據(jù)寬度縮放
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.
處理字體是一件非常有趣的事情,因?yàn)樽煮w會(huì)帶出網(wǎng)站或網(wǎng)頁的外觀,因此您必須為網(wǎng)站或網(wǎng)頁選擇理想的字體,這有助于使網(wǎng)站或網(wǎng)頁看起來很棒。 但是有時(shí)字體也可能帶來許多問題,例如重新縮放,這使我們進(jìn)入了當(dāng)前的話題, 根據(jù)CSS中的容器寬度重新縮放字體 。 這個(gè)問題很容易解決,但是在我們進(jìn)一步解決之前,讓我們先談?wù)勛煮w。
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.
如前所述,在開發(fā)網(wǎng)站或網(wǎng)頁時(shí)經(jīng)常使用字體。 因此,在選擇網(wǎng)站或網(wǎng)頁的主要字體時(shí)必須非常小心,因?yàn)樽煮w會(huì)定義文本對(duì)用戶的外觀,并且您知道文本是任何網(wǎng)站或網(wǎng)頁的最基本元素。 您可以從可用的字體數(shù)組中進(jìn)行選擇,只是在選擇字體時(shí)先預(yù)覽您的網(wǎng)站或網(wǎng)頁。 外觀不僅取決于正確的字體樣式,而且還取決于字體的大小。 您不希望您的網(wǎng)站或網(wǎng)頁顯得破舊,因此您必須為網(wǎng)頁或網(wǎng)站使用統(tǒng)一大小的字體。 現(xiàn)在讓我們討論如何根據(jù)CSS中的容器寬度重新調(diào)整字體,因?yàn)槟鷮⑿枰獌?nèi)容。
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.
要設(shè)置字體大小,可以使用視口“ 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應(yīng)用于h1標(biāo)簽內(nèi)的內(nèi)容。
Be wise:
聰明點(diǎn):
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屬性,該屬性將有助于根據(jù)瀏覽器窗口調(diào)整字體大小。 因此,開始調(diào)整字體大小,開始使您的網(wǎng)站或網(wǎng)頁外觀時(shí)尚并可以部署。 確保為網(wǎng)站或網(wǎng)頁選擇合適的字體,因?yàn)榇藢傩詫⒏鶕?jù)瀏覽器窗口更改字體大小,因此,請(qǐng)明智選擇。
翻譯自: https://www.includehelp.com/code-snippets/rescale-font-based-on-container-width-in-css.aspx
css圓在中心根據(jù)寬度縮放
總結(jié)
以上是生活随笔為你收集整理的css圆在中心根据宽度缩放_根据CSS中的容器宽度重新缩放字体的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c# contains_清单 .Con
- 下一篇: MyBatis 的执行流程,学废了!