css圆在中心根据宽度缩放_根据CSS中的容器宽度重新缩放字体
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中的容器宽度重新缩放字体的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c# contains_清单 .Con
- 下一篇: repeating 路由_CSS中带有示