html - 如何将两个 p 元素并排放置

标签 html css web

<分区>

如何将两个 p 元素并排放置,

使用内联方法,p 元素中的每一行都会出现锯齿状,那么正确的方法是什么? “我找不到任何问题” 这是我的代码

body {
  margin: 0;
  padding: 0;
}

.div1 {
  width: 100%
}

p {
  margin: 0;
}

.p1 {
  width: 50%;
  background: rgb(136, 224, 220);
}

.p2 {
  width: 50%;
  background: rgb(114, 235, 131);
}
<div class="div1">
  <p class="p1">
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus PageMaker including versions of Lorem Ipsum.
  </p>
  <p class="p2">
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
    software like Aldus PageMaker including versions of Lorem Ipsum.
  </p>
</div>

这里是答案

p {
  margin: 0;
  display:inline;
  float:left;
 }

最佳答案

在 css 中更改 display 或使用不同的元素,如 span

.Same{
  display:inline-block;
}
<p class='Same'>Good</p>
<p class='Same'>Bad</p> 

关于html - 如何将两个 p 元素并排放置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49533552/

上一篇:html - 创建倾斜的 div 并水平和垂直对齐它们

下一篇:jquery - 在将鼠标悬停在某些内容上的同时,替换内容

相关文章:

javascript - CSS-jquery 单击色板图标更改背景色板

javascript - 如何将这些按钮的效果更改为选择以便删除按钮?

html - 使输入类型为 ="Password"在移动设备上使用数字键盘

html - 水平 css 列表包装问题

javascript - 即使有一个框未选中,如何禁用“允许”按钮?仅当选中所有复选框时才应启用“允许”按钮?

css - 使内联对齐 div 成为链接(显示 : block does not work)

javascript - 如何选择特定类名的所有元素?

javascript - 网页中的异常数据格式

android - 将通知从基于 Web 的应用程序推送到 Android

css - DiscordApp 的自定义 CSS 代码