我猜是很常见的问题,但是找不到任何解决方案。
代码是:
<div class="container">
<div class="first-item">A</div>
<div class="second-item">B</div>
</div>
应如下所示:
first-item
将在中间,second-item
应该在最后。
我尝试过的事情:
.container {
display: flex;
justify-content: center;
}
.container .second-item {
align-self: flex-end;
}
如何使用flex
或以其他任何方式css
实现它?
答案 0 :(得分:2)
您可以尝试
mounted() {
var dropzoneComponent = new Dropzone (
'#dropzone',
{
url: 'file/upload',
createImageThumbnails: false,
previewsContainer: '#template-preview',
acceptedFiles: '.svg',
init: function() {
this.on ('complete', function() {
window.location.href='http://localhost:8080/edit-draft'
})
this.on('addedfile', function(file) {
localStorage.setItem('file', JSON.stringify(file))
})
},
}
)
},
Here it gets called from the LocalStorage
data: () => ({
mode: "edit",
svgFile: localStorage.getItem('file'),
floorStore: store.floor
}),
.container {
display: flex;
justify-content: center;
}
.container .second-item {
right: 0;
position: absolute;
}
答案 1 :(得分:1)
几乎:您只需要在第一个元素上添加一个边距auto
.container {
display: flex;
justify-content: center;
}
.first-item {
margin: auto;
}
.second-item {
align-self: flex-end;
}