html - 将文本与 svg 图像对齐

标签 html svg

如何将下一个放在 svg 对象旁边。

我得到的结果是: enter image description here

我想要的结果是在 svg 图像旁边添加文本: enter image description here

这是 HTML:

<div class="alert alert-success smallFont" id="instruction">
<object data="images/information.svg" type="image/svg+xml" id="object">
<p id="mapsInstructionOne" class="mapsInstructionOne" align="center"></p>   
</object>
</div>

最佳答案

您可以使用 CSS 并更改标记来实现此目的:

HTML:

<div class="alert alert-success smallFont" id="instruction">
<p id="mapsInstructionOne" class="mapsInstructionOne" align="center"></p> 
<object data="images/information.svg" type="image/svg+xml" id="object"></object>     
</div>

然后在 CSS 文件中,您可以使用 float 作为段落标记:

#mapsInstructionOne {
    float: right;
}

根据您希望文本如何换行,您也可以选择 float 对象标记。在这种情况下 -

HTML:

<div class="alert alert-success smallFont" id="instruction">
<object data="images/information.svg" type="image/svg+xml" id="object"></object>
<p id="mapsInstructionOne" class="mapsInstructionOne" align="center"></p> 
</div>

CSS:

#object {
    float: left;
}

注意:这些示例将段落标记从对象标记的子级中删除。

关于html - 将文本与 svg 图像对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22675452/

相关文章:

html - 背景图片适用于 Firefox 和 Explorer,但不适用于 Safari 或 Chrome

svg:当外部容器旋转时停止内部组旋转

eclipse - 在 Eclipse 中编辑 SVG

javascript - D3 将 x 轴标签定位在矩形内并旋转 90 度

javascript - 在调整浏览器窗口大小时防止 jQuery 弹出窗口换行

html - Bootstrap Nav 标志问题

javascript - 如果未从根访问单页 Web 应用程序 (SPA),则保证 HTML 信息

javascript - 关于如何使用其中的元素对 ul 的每一侧进行编号的任何想法?

javascript - 如何为 SVG 多边形点设置动画?

javascript - 使用D3 data().enter()