简体   繁体   English

如果文字不在边框内,请使其隐藏CSS和HTML

[英]If text is outside the border, make it hiddent CSS and HTML

i have a round div whit background picture inside it. 我里面有一个圆形的div惠特背景图片。 The picture outside the round div is hidden, can i do the same for paragraph text whit css and html only? 圆形div外面的图片是隐藏的,我只能对css和html段落文本执行相同的操作吗? here is JSfiddle 这是JSfiddle

<div class="containereye">
  <div class="eye">
    <p class="eyetext">hello</p>
  </div>
</div>

.containereye{
  width:200px;
  height:200px;
}
.eye{
  box-sizing: border-box;
  box-shadow:0 5px 5px black inset;
width: 150px;
height: 150px;
border-radius: 100%;
background-image: url("http://i0.wp.com/himcistka.ru/wp-content/uploads/2015/03/centrifugaphotoshop-e1444999478943fs.jpg");
background-size: 250px;
background-position: center;
    -webkit-transition: background-size .5s ease-in-out; /* For Safari 3.1 to 6.0 */
    transition: background-size .5s ease-in-out;
    background-repeat: no-repeat;

}
.eyetext{
  background:red;

}
.eye:hover{
  background-size: 350px;
}

You can. 您可以。 Modify the .eye css class like this : 修改.eye css类,如下所示:

.eye{
  overflow: hidden;
  box-sizing: border-box;
  box-shadow:0 5px 5px black inset;
  width: 150px;
  height: 150px;
  border-radius: 100%;
  background-image: url("http://i0.wp.com/himcistka.ru/wp-content/uploads/2015/03/centrifugaphotoshop-e1444999478943fs.jpg");
  background-size: 250px;
  background-position: center;
  -webkit-transition: background-size .5s ease-in-out; /* For Safari 3.1 to 6.0 */
  transition: background-size .5s ease-in-out;
  background-repeat: no-repeat;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM