我正在为我的网站做一个导航栏.我有一个div,我想在其中有一个徽标,并在最右边对齐一个下载按钮.我使用了css属性‘JUSTIFY-CONTENT’和‘SPACE-BETWEEN’来将按钮向右对齐.然而,当我在div的左侧添加填充时,按钮被推出页面.
以下是我的代码:
body, html {
margin: 0;
background-color: #000000;
}
#header {
padding-top: 10px;
padding-bottom: 10px;
height: 30px;
position: fixed;
background-color: rgb(10, 98, 160, .5);
width: 100%;
border-bottom: 1px solid #808080;
display: flex;
justify-content: space-between;
padding-left: 20px;
}
<div id="header">
<img src="titanium_tsp.png" height="100%">
<button>Download</button>
</div>