Html 使图像居中而不显示块
我的html:Html 使图像居中而不显示块,html,css,center,Html,Css,Center,我的html: <p> <a href="#"> <img src="image.png" /> </a> </p> <p>Some text</p> 但它不起作用 图像宽度可以不同 你知道如何使图像居中并只在图像上留下可点击区域吗?将边距更改为50% img{ margin:0 50%; display:inline-block;
<p>
<a href="#">
<img src="image.png" />
</a>
</p>
<p>Some text</p>
但它不起作用
图像宽度可以不同
你知道如何使图像居中并只在图像上留下可点击区域吗?将边距更改为50%
img{
margin:0 50%;
display:inline-block;
}
将利润率更改为50%
img{
margin:0 50%;
display:inline-block;
}
将
img
的父对象对准中心
HTML:
将
img
的父对象对齐到中心
HTML:
试试这个
<p id="imgPara">
<a href="#">
<img id="image" src="http://httpd.apache.org/docs/current/images/feather.gif" />
</a>
</p>
<p>Some text</p>
#imgPara{
text-align: center;
}
一些文本
#伊姆帕拉{
文本对齐:居中;
}
试试这个
<p id="imgPara">
<a href="#">
<img id="image" src="http://httpd.apache.org/docs/current/images/feather.gif" />
</a>
</p>
<p>Some text</p>
#imgPara{
text-align: center;
}
一些文本
#伊姆帕拉{
文本对齐:居中;
}
您可以为
a
标记设置此CSS:
a{
margin:0 auto;
display:table;
}
演示您可以为
a
标记设置此CSS:
a{
margin:0 auto;
display:table;
}
演示你想要文本也在中心?@Hiral,不只是图像。你想要文本也在中心?@Hiral,不只是图像。只有图像,不是文本。只有图像,不是文本。我无法访问它用所见即所得生成的
。我无法访问它用所见即所得生成的
。这不起作用。因为这将占据主窗口的50%,然后将图像移到另一侧。这将不起作用。因为这将占据主窗口的50%,然后将图像移到另一侧..Greate,它可以工作。没有想过尝试其他显示属性。太好了,它可以工作。没有考虑尝试其他显示属性。