Css内容被截断

时间:2017-10-25 06:09:24

标签: html css css3 styles css-position

我的例子:https://jsfiddle.net/ymkokef5/

我的问题(X似乎被切断了) - 如何将X放在"框内#34;

enter image description here

我在我的演示网站上使用<button class="modal-close"></button>

我想定位一个&#34; X&#34; (关闭)在左上角。

&#13;
&#13;
.modal-close {
  position: absolute;
  z-index: 9999;
  overflow: hidden;
  top: 28px;
  left: 28px;
  margin: 0;
  padding: 0;
  font-size: 40px;
  line-height: 1;
  width: 0.75em;
  height: 0.75em;
  cursor: pointer;
  background: none;
  border: 0;
  color: #888888;
}

.modal-close::after {
  content: "X";
}

.modal-close::after {
  position: absolute;
  top: -0.025em;
  left: -0.1em;
  padding: 0
}

.flexbox {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  /* establish flex container */
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  /* make main-axis vertical */
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  /* align items vertically, in this case */
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  /* align items horizontally, in this case */
  height: 100%;
  /* for demo purposes */
  width: 100%;
}

#Kurzfilm video {
  margin: 0 auto;
  display: inline-block;
  position: absolute;
}

#Kurzfilm .overlay {
  background-color: #ffffff;
  opacity: 1;
  width: 100%;
  height: 100%;
  z-index: 80;
  position: absolute;
  top: 0;
  left: 0;
}

#Kurzfilm video,
#modal .window {
  z-index: 90;
}

#Kurzfilm {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 90;
}

body,
html {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: Arial;
  font-size: 1vw;
  font-weight: normal;
  color: #000000;
}
&#13;
<div id="Kurzfilm">
  <button class="modal-close"></button>
  <div class="overlay"></div>
  <div class="flexbox">
    <video width="320" height="240">
    <source src="https://www.w3schools.com/html/movie.mp4" type="video/mp4">
    Your browser does not support the video tag.
  </video>
  </div>
</div>
&#13;
&#13;
&#13;

3 个答案:

答案 0 :(得分:1)

.modal-close::after {
  position: absolute;
  top: 0em;
  left: 0em;
  padding: 0
}

使top和left = 0em,这会将它带到绝对角落

OR

.modal-close {
  position: absolute;
  z-index: 9999;
  overflow-x: visible;
  top: 28px;
  left: 28px;
  margin: 0;
  padding: 0;
  font-size: 40px;
  line-height: 1;
  width: 0.75em;
  height: 0.75em;
  cursor: pointer;
  background: none;
  border: 0;
  color: #888888;
}

使overflow-x可见以解除X

答案 1 :(得分:0)

尝试此更改

.modal-close::after {
    position: absolute;
    top: -0.1em;
    left: 0.03em;
    padding: 0;
}

答案 2 :(得分:0)

简单说明:

之后给出类.modal-close ::的字体大小
.modal-close::after {
content: "X";
font-size: 18px;

}

移动左侧

.modal-close::after {
position: absolute;
top: -0.025em;
left: 0.9em;
padding: 0;

}

我已经在jsfiddle中更新了