在Jekyll帖子中包含具有自定义大小属性的图像 [英] Including an image in a Jekyll post with custom size attribute

查看:64
本文介绍了在Jekyll帖子中包含具有自定义大小属性的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Jekyll帖子中,我想包含我在地址images/posters/surfaces.png中拥有的图像.

In a Jekyll post I want to include an image I have in the address images/posters/surfaces.png.

此外,我希望它的宽度为750px.

Furthermore, I want it to have a 750px width.

我尝试了<img src={images/posters/surfaces.png} alt="Poster" style="width: 750px;"/><img src="images/posters/surfaces.png" alt="Poster" style="width: 750px;"/>,但是没有用.

I tried <img src={images/posters/surfaces.png} alt="Poster" style="width: 750px;"/> and <img src="images/posters/surfaces.png" alt="Poster" style="width: 750px;"/> but it did not work.

我应该改用哪种语法?

推荐答案

相对链接会引起混乱,最好使用绝对URL,例如:

Relative links lead to confusion, better use absolute URLs like:

 {{ "images/posters/surfaces.png" | absolute_url }}

或者,如果您不会在子目录中使用Jekyll,只需使用/images/posters/surfaces.png(请注意斜杠).

Or if you won't use Jekyll in a subdirectory, just use /images/posters/surfaces.png (note the leading slash).

这篇关于在Jekyll帖子中包含具有自定义大小属性的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆