如何避免 html 元素相互重叠?

How to avoid overlapping of html elements over each other?

我在创建内容时遇到了问题。我想要我的 body 中的一些 <kbd> 标签应该正确对齐。我能够这样做,但问题是 <kbd> 元素相互重叠。所以我想知道如何使 <kbd> 元素保持右对齐并避免它们重叠。

.me_msg {
  background: rgb(250, 250, 250);
  border-radius: 10px 10px 0px 10px;
  border-width: 1px;
  color: #003cff;
  padding: 10px;
  text-align: right;
  padding: 1.1% 4% 1.1% 4%;
  position: absolute;
  right: 03%;
  top: auto;
  bottom: auto;
  min-width: 20%;
  max-width: 40%;
  box-shadow: 0px 0px 3px #e9e9e9;
  display: block;
}
<kbd class='me_msg'>My First Message</kbd>
<kbd class='me_msg'>My Second Message</kbd>
<kbd class='me_msg'>My Third Message</kbd>

不要使用绝对,除非你想定位每个按钮separately/manually。

一个简单的解决方案是向右浮动。

.me_msg {
  background: rgb(250, 250, 250);
  border-radius: 10px 10px 0px 10px;
  border-width: 1px;
  color: #003cff;
  padding: 10px;
  text-align: right;
  margin-left: 10px;
  padding: 1.1% 4% 1.1% 4%;
  position: relative;
  float: right;
  min-width: 20%;
  max-width: 40%;
  box-shadow: 0px 0px 3px #e9e9e9;
  display: block;
}
<kbd class='me_msg'>My First Message</kbd>
<kbd class='me_msg'>My Second Message</kbd>
<kbd class='me_msg'>My Third Message</kbd>

如果我答对了你的问题,这是一个演示 我的意思是 css 部分

 .me_msg {
         background:rgb(250,250,250);
         border-radius:10px 10px 0px 10px;
         border-width:1px;
         color:#003cff;
         padding:10px;
         text-align:right;
         padding:1.1% 4% 1.1% 4%; 
             float: right;
             display: inline-block;
             bottom:auto;
         min-width:10%;     
             max-width:40%;
         box-shadow:0px 0px 3px #e9e9e9;
        }

Link https://jsfiddle.net/1uh3ha5w/