Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尝试使用HTML/CSS对齐内联图像下的文本_Html_Css - Fatal编程技术网

尝试使用HTML/CSS对齐内联图像下的文本

尝试使用HTML/CSS对齐内联图像下的文本,html,css,Html,Css,我正在尝试使用HTML/CSS将我的文本与一行3个图像对齐。作为 一旦我删除我的评论,它就会将所有内容垂直对齐 <div class="inline"> <img class="rel" src="http://imgur.com/a/n2skT.png" alt="icon" /> <!-- <p> This is a test</p> --> <img

我正在尝试使用HTML/CSS将我的文本与一行3个图像对齐。作为 一旦我删除我的评论,它就会将所有内容垂直对齐

<div class="inline">     
        <img class="rel" src="http://imgur.com/a/n2skT.png" alt="icon" />
        <!-- <p> This is a test</p> -->         
        <img class="rel" src="http://imgur.com/a/n2skT.png" alt="icon" />
        <!-- <p> This is a test</p> -->         
        <img class="rel" src="http://imgur.com/a/n2skT.png" alt="icon" />
        <!-- <p> This is a test</p> -->      
    </div>

看我的例子

提前谢谢


Ivan

您可以将每个
img
p
包装在
div
中,并将
display:inline block
添加到
div

.inline{
文本对齐:居中;
}
.包裹{
显示:内联块;
利润率:0.2%;
}

这是一个测试

这是一个测试

这是一个测试


默认情况下是块级元素,因此总是从新行开始。非常感谢Mihai T。你可能知道我可以在某处学习的一个很好的信息教程吗?我在回答中添加了一些链接,我不知道有任何教程可以让你准确地了解你想要的内容,但你需要从不同的地方学习,然后利用这些知识来实现你所需要的