html - 如何在 <div> 中将 <p> 放在 <img> 旁边?

标签 html image

我需要在 html 页面中的图像左侧放置一个段落。现在,文本在图像旁边,但段落本身在图像后面延伸到容器的左侧。我希望它们只是彼此并排,内联,段落中的文本像普通文本一样环绕。

<div class="content-box">
            <h1>Welcome to Genesis of Robotics!</h1>
            <p>Unrelated text </p>
                <div id="holder">
                    <img id="problem-image" src="css/images/problem_image.jpg" width="500px" height="300px">
                    <p class="p">The Problem Text</p>
                </div>
            <img src="css/images/define.png" width="200px" height="200px">
            <img src="css/images/brainstorm.png" width="200px" height="200px">
        </div>

CSS:

#drawing-image {border-radius: 15px; }
    .content-box h1{color:#fff; text-align: center; margin: auto; width: 630px;    background: url(css/images/paper.png); padding: 12px; border-radius: 15px;}
    .content-box p{padding-top: 40px; padding-bottom: 40px;}
    #holder {height: 0px; width: auto; height: auto; }
    #holder p { height: auto; width: 100px; }
    #holder img { margin: 15px; }

最佳答案

这个怎么样? #holder img { float :左;显示:内联; padding-right:10px;} #holder p {display:inline;}

关于html - 如何在 <div> 中将 <p> 放在 <img> 旁边?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13371386/

相关文章:

html - 替代 HTML 语法

javascript - 拦截点击 iframe 中的内容

填写输入类型后,Android 键盘显示 "Go"键而不是 "next"

java - Android - ImageView 不显示照片

java - 从 PDF 中提取的图像水平碎片化

html - ./和 ../当我使用它来包含文件时有什么区别?

javascript - 如何从外部页面链接操作元素的数据属性?

css - 您应该使用 CSS 还是照片编辑工具为移动设备升级图像?

iphone - PNG 质量在 iPhone 上看起来很糟糕

html - 创建全宽图像