GitHub地址:https://github.com/youlookwhat
首先看一下显示效果:
有时候为达到美好的排版方式,我们会有多种显示图片的需求,现在我们来依次试试
显示图片的方式有这样几种:
1.引入HTML,格式如下:
![](img_url)
“[]”里放的是图片描述文字。这样图片就会靠在左侧,大小也不由自己决定,例如:
2.固定图片显示大小:
你是不是觉得以上的图片不是你想要的尺寸呢,没关系,你可以自定义尺寸:
<img width="150" height="150" src="https://s4.51cto.com/images/blog/202112/31054545_61ce2889e85dd22976.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk="/>
分别在“width”和“height”设置你想要的宽高就好了,就成这样:
你也可以加上描述文字就是这样:
<img src="https://s4.51cto.com/images/blog/202112/31054545_61ce2889e85dd22976.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=" width="150" height="200" alt="图片描述文字"/>
3.固定图片显示大小且居中:
这时候想到也许居中会更好,于是我们试试居中
<div align=center><img width="150" height="150" src="https://s4.51cto.com/images/blog/202112/31054545_61ce2889e85dd22976.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk="/></div>
只要在外面包围div标签就好了,就是这样显示了: