您的位置:首页 > 职场人生

阿里2015校招前端方向的一道面试题

2016-02-15 22:55 393 查看
题目如图:



解答代码如下:

<html>
<head>
<style>
div{
height:100px;
width:60px;
float:left;
margin-left:100px;
font-size:24px;
font-weight:bold;
line-height:100px;
color:white;
background-color:black;
text-align:center;
}
</style>
</head>
<body>
<main>
<div>A</div>
<div>B</div>
<div>C</div>
</main>
</body>
</html>


我实现的效果如图:



这道题应该考察的是居中对齐,将文本的
line-height
设为容器等高就能上下居中,
text-align
设为
center
就实现了左右居中。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: