请问老师为什么我的放大镜一直不能被包在wrapper里面?
来源:7-4 使用 iconfont 嵌入头部图标
qq_Sakuragi10_0
2019-03-06
export const SearchWrapper = styled.div`
float: left;
position: relative;
.iconfont {
position: absolute;
right: 5;
bottom: 5px;
width: 30px;
line-height: 30px;
border-radius: 15px;
text-align: center;
background: green;
}
`;
export const NavSearch = styled.input.attrs({
placeholder: 'Search'
})`
width: 160px;
height: 38px;
padding: 0 20px;
box-sizing: border-box;
border: none;
outline: none;
border-radius: 19px;
margin-top: 9px;
margin-left: 20px;
background: #eee;
font-size: 14px;
&::placeholder {
color: #999;
}
`;
以上是style.js里的NavSearch和SearchWrapper的内容
然后是index的Nav里的内容
<Nav>
<NavItem className='left active'>Index</NavItem>
<NavItem className='left'>Download App</NavItem>
<NavItem className='right'>Sign in</NavItem>
<NavItem className='right'>
<i className="iconfont"></i>
</NavItem>
<SearchWrapper>
<NavSearch></NavSearch>
<i className="iconfont"></i>
</SearchWrapper>
</Nav>
结果显示出来是这样:
请问老师这个是怎么回事呢?谢谢!
写回答
1回答
-
同学你好,我建议你到chrome的style控制台里面摆弄摆弄,这样比较靠谱,直接贴代码调试样式,我这有点不好处理。
012019-03-07
相似问题