当前位置:网站首页>Generate filled text and pictures
Generate filled text and pictures
2022-07-05 05:03:00 【Fierce chicken】
Generate filled text and pictures
A common word in front-end design is placeholder, This word often means that its corresponding content is the temporary filling content in the current page . In the design of front-end pages , Sometimes in order to better see the layout effect , You need to fill some parts of the page with text or pictures , It can be automatically generated at this time Fill in the text (placeholder text) And custom size Fill in the picture (placeholder image) That comes in handy
Generate fill text
Here I use VSCode built-in Emmet To generate fill text ( Some mainstream front-end editors commonly used are generally embedded with the function of filled text or support some plug-ins for filled text )
Need to input emmet Instruction is lorem. After the instruction takes effect, a piece of Latin text in the form of garbled code will be generated , be called Fill in the text ,placeholder text
Through this, you can fill in some fields where you need to fill in text when designing the front-end page , It is convenient to design a reasonable layout effect . For example, you are designing a message board , I hope to fill in some words to see the effect , At this point, you can use these filled text . in addition , Some developers are designing fonts , In order to verify the effect , You will also use these filled text
Use lorem The generated text filling of instructions is called Lorem Ipsum, In fact, there are other placeholder text, If you want to know more information, you can go to some websites :
https://placeholder.com/text/lorem-ipsum/
https://placeholder.com/text/

Generate fill image
here , The way I introduced to generate filled images is to use an address link that can generate filled images :
https://via.placeholder.com( perhaps http://via.placeholder.com)
This link can be changed URL The path of (path) To generate a specified size 、 Specify the text color , And fill pictures with specified background colors , And you can also modify the query string (query) Specify the text content
Specify the size of the generated picture
stay https://via.placeholder.com Add the width or height parameters of the picture on the basis of , You can generate pictures of a specified size ( Unit is px)
For example, now we need to generate a 500x500 Pictures of the , You can use any one URL:https://via.placeholder.com/500https://via.placeholder.com/500x500
This needs to be explained :
- When the height and width of the desired picture are equal , You can omit high , Only attach the width value , At this time, the default height and width are equal
- When the height and width are different , You need to explicitly write the height and width , also Wide in front 、 High in the back , Use letters
xConnect ( It can be in both case ). such as500x300The picture of needs to be written ashttps://via.placeholder.com/500x300 - here The default size, height and width values are in the middle of the generated image . Such as the above
https://via.placeholder.com/500, There are “500x500” The words... . You can specify the text in the picture by yourself ( See below ) - When two filled pictures of the same size are not assigned a background color , It will automatically produce different background colors ( See the following for the color )
- If If the height and width are not specified, the picture cannot be generated
How to use
Generally, a picture label is placed directly in the place that needs to be filled <img/>, Among them src The value of is to fill the picture URL
<!-- The following boxes are set with left float -->
<div style="width: 500px; height: 500px"><img src="https://via.placeholder.com/500" alt="500x500"></div>
<div style="width: 500px; height: 500px"><img src="https://via.placeholder.com/500X500" alt="500x500"></div>
<div style="width: 500px; height: 300px"><img src="https://via.placeholder.com/500X300" alt="500x300"></div>
<div><img src="https://via.placeholder.com" alt="nothing"></div>

Specify the text content
adopt modify URL Query string in (query string)?text To specify custom text content . Usage is as follows :
https://via.placeholder.com/500?text=Hello+World
The resulting image is as follows

The specified content is Hello+World, Among them + Said the blank space
Specify the text color and background color of the generated picture
By modifying the URL Of path To specify the text color and background color , The color value takes hexadecimal value ( No need to prefix 0x). If not specified, the default background is gray , The text is black ( Strictly speaking, it's only dark gray ), But sometimes it's not necessarily this color ( I don't know why? )
Pay attention here The value of the background color is first , Text color value after , also The color must be specified after the height and width , Otherwise, the picture cannot be generated
<div style="width: 500px; height: 500px">
<img src="https://via.placeholder.com/500/ffff00/ffffff" alt="500x500">
</div>

Specify the format of the generated picture
None of the above examples specify the image format , The default is .gif. The image formats supported by this link are .png、.gif、.jpg、.jpeg、.webp
The format can be specified in URL The end of any option ( Cannot be after the query string , If you follow the query string, only text is generated , Do not specify the image format )https://via.placeholder.com/500.pnghttps://via.placeholder.com/500x300.pnghttps://via.placeholder.com/500x300.png?text=hello+worldhttps://via.placeholder.com/500/fff.pnghttps://via.placeholder.com/500/fff.png/ff0https://via.placeholder.com/500/fff/ff0.png
In addition, you can check the official website for more information :https://placeholder.com
Only generate healing cat fill pictures
Here is a link to generate a filled image that only generates pictures of cured cats :
https://placekitten.com/
By changing path Specify image size , The rules are different from the above :
The height and width information here must also be specified , High can be omitted , At this time, the default is square . But when specifying the height and width , Values of width and height Not used x Connect , Instead, fill in the width and height as an option of the path respectively :
https://placekitten.com/500/300 # That's right
https://placekitten.com/500 # It's also true , This is a square picture
https://placekitten.com/500x500 # This is wrong
This fill picture Only size can be specified , Cannot specify color 、 Written content
Here is a picture I got randomly from this link :

Reference resources :
https://placeholder.com
https://placeholder/text.com
https://placeholder.com/text/lorem-ipsum/
https://placekitten.com
边栏推荐
- Kali 2018 full image download
- AutoCAD -- dimension break
- Unity writes timetables (without UI)
- Personal required code
- [LeetCode] 整数反转【7】
- Dotween usage records ----- appendinterval, appendcallback
- 中国针状焦行业发展研究与投资价值报告(2022版)
- Three dimensional dice realize 3D cool rotation effect (with complete source code) (with animation code)
- 中国艾草行业研究与投资前景预测报告(2022版)
- 2021 huashubei mathematical modeling idea + reference + paper
猜你喜欢

2022 thinking of mathematical modeling D problem of American college students / analysis of 2022 American competition D problem

【Leetcode】1352. Product of the last K numbers

Detailed introduction of OSPF header message

Thinking of 2022 American College Students' mathematical modeling competition

LeetCode之單詞搜索(回溯法求解)

《动手学深度学习》学习笔记

2022 thinking of mathematical modeling C problem of American college students / analysis of 2022 American competition C problem

AutoCAD - scaling

2022 thinking of Mathematical Modeling B problem of American college students / analysis of 2022 American competition B problem

django连接数据库报错,这是什么原因
随机推荐
Lua determines whether the current time is the time of the day
AutoCAD - stretching
cocos2dx_ Lua card flip
嵌入式数据库开发编程(六)——C API
Unity connects to the database
This article is good
2021 huashubei mathematical modeling idea + reference + paper
Dotween usage records ----- appendinterval, appendcallback
Detailed introduction of OSPF header message
django连接数据库报错,这是什么原因
中国艾草行业研究与投资前景预测报告(2022版)
Animation
Detailed explanation of the ranking of the best universities
3dsmax scanning function point connection drawing connection line
LeetCode之单词搜索(回溯法求解)
AutoCAD - Zoom previous
3dsmax common commands
Solutions and answers for the 2021 Shenzhen cup
2022/7/1學習總結
AutoCAD - Center zoom