问答详情
源自:13-9 Relative与Absolute组合使用

为什们我的文字没有在图片里,想哭???

<html>
	<meta charset="utf-8" />

		<head>
		<title>自我介绍</title>
		<style type="text/css">
		
		.box1{width:200px;
    height:200px;           position:relative;
		              }
		.box2{ width:99%;   position:absolute;
		bottom:0; left:o;}
		</style>
		<div  class=".box1"><img  src="http://img.mukewang.com/52b4113500018cf102000200.jpg" >
		<div class=".box2">这是我的女朋友 </div>
		</div>
	</body>
</html>


提问者:qq_花裤衩_2 2017-11-07 20:26

个回答

  • 唐特不灵
    2017-11-07 20:47:05
    已采纳

    把class=".box1"和class=".box2"中的“.”去掉,前面的.box1{}中"."是类选择符,类名应该是个box1http://img.mukewang.com/5a01ab440001489b19201080.jpg

  • 狐狸小米
    2017-11-07 20:36:43

    <html>

        <meta charset="utf-8" />

     

            <head>

            <title>自我介绍</title>

            <style type="text/css">

             

            .box1{width:200px;

        height:200px;           position:relative;

                          }

            .box2{ width:99%;   position:absolute;

            bottom:0; left:o;}

            </style>

            <div  class="box1"><img  src="http://img.mukewang.com/52b4113500018cf102000200.jpg" >

            <div class="box2">这是我的女朋友 </div>

            </div>

        </body>

    </html>