簡體   English   中英

CSS內容被切斷

[英]Css Content is cut off

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

我的問題(X似乎已被切斷)-如何將X放置在“盒子”內?

在此處輸入圖片說明

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

我想在左上方放置一個“ X”(關閉)。

 .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; } 
 <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> 

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

使頂部和左側= 0em,這會將其帶到絕對角

要么

.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

試試這個變化

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

簡單點:

給出類.modal-close :: after的字體大小

.modal-close::after {
content: "X";
font-size: 18px;

}

向左移動

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

}

我已經在jsfiddle中更新了

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM