HTML img align =“middle”不工作 [英] HTML img align="middle" not working

查看:447
本文介绍了HTML img align =“middle”不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



所以这个问题可能非常容易回答。



我想要一个图像居中对齐。图像大小固定为像素。



所以我想要的是这样 -





我所做的是 -

 <!DOCTYPE html> 
< html>
< body>

src =http://icons.iconarchive.com/icons/rokey/popo-emotions/128/big-smile-icon.png
width =42height =42
align =middle
style =float:left;
position:relative;
display:block;
margin-left:auto;
margin-right:auto;
z-index:1;
>

< / body>
< / html>

但我越来越多 -



< img src =https://i.stack.imgur.com/VDkkg.jpgalt =22>



我希望它能够响应。

p>

任何人都可以帮我吗?



预先感谢您的帮助。

解决方案

这个怎么样?我经常使用CSS Flexible Box Layout来集中一些东西。



< div style =display:flex; justify-content:center;> ; < img src =http://icons.iconarchive.com/icons/rokey/popo-emotions/128/big-smile-icon.pngstyle =width:40px; height:40px; />< / div>

I am new in HTML.

So this question may be so much easy to answer.

I want a image to be centered aligned. Image size is fixed in pixels.

So what I want is like this-

.

What I have done is-

        <!DOCTYPE html>
<html>
<body>

    <img
        src="http://icons.iconarchive.com/icons/rokey/popo-emotions/128/big-smile-icon.png"
        width="42" height="42"
        align="middle"
        style="float: left;
          position: relative;
          display: block;
          margin-left: auto;
          margin-right: auto;
          z-index: 1;"
        >

</body>
</html>

But I am getting-

I want it to be responsive.

Can anyone help me please?

Thanks in advance for helping.

解决方案

How about this? I frequently use CSS Flexible Box Layout to center something.

<div style="display: flex; justify-content: center;">
  <img src="http://icons.iconarchive.com/icons/rokey/popo-emotions/128/big-smile-icon.png" style="width: 40px; height: 40px;" />
</div>

这篇关于HTML img align =“middle”不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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