在下面的代码中(小提琴:https://jsfiddle.net/tno3n3cq/),我希望看到一行有两列。相反,我看到两行。
我希望看到一行,因为:
我的推理在哪里错了?
* {
box-sizing: border-box;
}
.filelist {
width: 500px;
}
.bem-file {
height: 37px;
}
.bem-left-side {
width: 300px;
display: inline-block;
}
.bem-right-side {
width: 200px;
display: inline-block;
}
<div class="filelist">
<div class="bem-file">
<div class="bem-left-side">
left
</div>
<div class="bem-right-side">
right
</div>
</div>
</div>
答案 0 :(得分:0)
尝试使用此代码,您将缺少display:class filelist的内联属性
.filelist {
width: 500px;
display: inline;
}
* {
box-sizing: border-box;
}
.bem-file {
height: 37px;
}
.bem-left-side {
width: 300px;
display: inline-block;
}
.bem-right-side {
width: 200px;
display: inline-block;
}
.bem-file-name {
display: inline;
}
.bem-upload-progress {
}
.alert-icon {
color: red;
}
/* wuh? this is \e999 in the global icon demo. Did we get an old version? */
.alert-icon:before {
content: "\e99b";
color: #d37d7d;
}
&#13;
<div class="filelist">
<div class="bem-file bem-file-error">
<div class="bem-left-side">
<span class="alert-icon"></span>
<div class="bem-file-name">ripgrep-0.5.2-x86_64-apple-darwin.tar</div>
</div>
<div class="bem-right-side">
<span class="status-message">File type invalid</span>
<span class="bem-upload-progress"></span>
<span aria-label="Remove" class="bem-remove-file bem-remove-file-error"></span>
</div>
</div>
</div>
&#13;
答案 1 :(得分:0)
希望这有帮助
* {
box-sizing: border-box;
}
.filelist {
width: 500px;
}
.bem-file {
height: 37px;
width: 100%;
background : red;
position:absolute;
}
.bem-left-side {
width: 300px;
display: inline-block;
background:yellow;
}
.bem-right-side {
width: 200px;
display: inline-block;
}
&#13;
<div class="filelist">
<div class="bem-file">
<div class="bem-left-side">
left
</div>
<div class="bem-right-side">
right
</div>
</div>
</div>
&#13;
答案 2 :(得分:0)
您可以从CSS中删除bem-left和bem-right的块声明。