老师帮忙看一下对不对?
来源:4-3 编程练习
慕田峪5398473
2019-02-17 21:15:37
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>文本样式</title>
<style type="text/css">
/*写出CSS样式*/
p{background-color:#eee;
font-size:2em;
line-height:5em;
}
.one{font-size:2em;}
.two{color:red;
text-decoration:underline;
text-transform:capitalize;
vertical-align:middle;
}
</style>
</head>
<body>
<!--写出html代码-->
<p>
<img src="http://climg.mukewang.com/59c21bae000157fa01000059.jpg">
<span class="one">CSS层叠样式表</span>
<span class="two">(cascading style sheets)</span>
</p>
</body>
</html>
2回答
Sherlock_bourne
2019-02-19
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>标答版用px来调节垂直居中</title>
<style type="text/css">
.div1{
background-color:#eee;
height:5em;
width:100%;
text-align:center;
display:table;
font-size:2em;
}
.div2{
display:table-cell;
vertical-align:middle;
}
.css{
font-size:2em;
vertical-align:5px;
}
.words{
color:red;
text-decoration:underline;
vertical-align:15px;
text-decoration:underline;
text-transform: capitalize;
}
</style>
</head>
<body>
<div class="div1">
<div class="div2"> <img src=" http://climg.mukewang.com/59c21bae000157fa01000059.jpg">
<span class="css">CSS层叠样式表</span>
<span class="words">(cascading style sheets)</span>
</div>
</div>
</body>
</html>
Steve007
2019-02-18
同学,你好。这里需要给.one,.two,img都设置vertical-align:middle;它们才会在同一行居中。
如图:

祝学习愉快!
相似问题