gpt4 book ai didi

html - 用于在绝对位置显示 div 的 css

转载 作者:太空狗 更新时间:2023-10-29 14:17:16 25 4
gpt4 key购买 nike

我想在 z-index:99 的给定图像上显示 div 'class=perspectiveHomeMenu'。

#perspective {
display: none;
}
img {
width: 100%;
/*for demo*/
height: 100px;
/*for demo*/
}
.perspectiveContent-submenuMenu {
display: none;
}
.perspectiveHomeContent {
width: 65%;
margin: 0% 5% 6%;
background-color: rgb(241, 241, 241);
float: left;
padding: 0%;
}
.perspectiveHomeContent .imageAlign {
float: left;
width: 100%;
}
.contentHomeAlign {
float: left;
margin: 2% 3%;
width: 98%;
padding: 1%;
}
.perspectiveHomecontentImage iframe,
.perspectiveHomecontentImage img {
width: 100% !important;
}
.contentHomeAlign .perspectiveContentHeading {
font-size: 14pt;
margin: 0% 0 0;
color: rgb(106, 90, 148);
}
.perspectiveContentHeading a {
color: rgb(106, 90, 148);
}
.contentHomeAlign p {
font-size: 10pt;
}
.authorshomeLink {
font-size: 11pt;
}
.perspectiveHomeMenu {
background-color: rgb(106, 90, 148);
/*-webkit-transform: skew(-20deg);*/
}
.perspectiveHomeMenu a {
background: rgba(0, 0, 0, 0) linear-gradient(to right, rgba(128, 70, 168, 1) 0%, rgba(163, 36, 168, 1) 100%) repeat scroll 0 0;
font-size: 10pt;
padding: 1%;
float: right;
position: relative;
color: #ffffff;
}
<div class="banner">
<img src="" alt="banner">
</div>
<div class="perspectiveContentsection">
<div class="perspectiveHomeContent">
<div class="imageAlign">
<div class="perspectiveHomecontentImage">
<img src="" alt="This is the image.Need to display blogs here">
</div>
<div class="perspectiveHomeMenu">
<a>Blogs</a>
</div>
</div>
<div class="contentHomeAlign">
<div class="perspectiveContentHeading"><a>Title of the content</a>
</div>
<div class="authorshomeLink"><a>Test Author</a>
</div>
<div>sample body content.sample body content.sample body content.sample body content.sample body content.</div>
<div class="perspectiveReadurl"><a>Read More</a>
</div>
</div>

</div>
</div>

我想在右上角的图片上显示博客

最佳答案

移动<div class="perspectiveHomeMenu">进入<div class="perspectiveHomecontentImage"> ,这是您的 HTML 中唯一的变化。

然后给position:relative;position:absolute;到父分区。我编辑的 css 如下:

.perspectiveHomecontentImage{
position:relative;
}
.perspectiveHomeMenu{
background-color:rgb(106,90,148);
/*-webkit-transform: skew(-20deg);*/
position:absolute;
right:0;
top:0;
}

这是您的工作片段:

#perspective{
display:none;
}
img{
width:100%; /*for demo*/
height:100px;/*for demo*/
}
.perspectiveContent-submenuMenu{
display:none;
}
.perspectiveHomeContent{
width:65%;
margin:0% 5% 6%;
background-color:rgb(241,241,241);
float:left;
padding:0%;
}
.perspectiveHomeContent .imageAlign
{
float:left;
width:100%;
}
.contentHomeAlign
{
float:left;
margin:2% 3%;
width:98%;
padding:1%;
}
.perspectiveHomecontentImage iframe,.perspectiveHomecontentImage img{
width:100% !important;
}
.contentHomeAlign .perspectiveContentHeading{
font-size:14pt;
margin:0% 0 0;
color:rgb(106,90,148);
}
.perspectiveContentHeading a{
color:rgb(106,90,148);
}
.contentHomeAlign p{
font-size:10pt;
}
.authorshomeLink{
font-size:11pt;
}
.perspectiveHomecontentImage{
position:relative;
}
.perspectiveHomeMenu{
background-color:rgb(106,90,148);
/*-webkit-transform: skew(-20deg);*/
position:absolute;
right:0;
top:0;
}
.perspectiveHomeMenu a{
background:rgba(0, 0, 0, 0) linear-gradient(to right, rgba(128, 70, 168, 1) 0%, rgba(163, 36, 168, 1) 100%) repeat scroll 0 0;
font-size:10pt;
padding:5px;
float:right;
position:relative;
color:#ffffff;
}
<div class="banner">
<img src="" alt="banner">
</div>
<div class="perspectiveContentsection">
<div class="perspectiveHomeContent">
<div class="imageAlign">
<div class="perspectiveHomecontentImage">
<img src="http://www.chinabuddhismencyclopedia.com/en/images/thumb/b/b8/Nature.jpg/240px-Nature.jpg" alt="This is the image.Need to display blogs here">
<div class="perspectiveHomeMenu">
<a>Blogs</a>
</div>
</div>
</div>
<div class="contentHomeAlign">
<div class="perspectiveContentHeading"><a>Title of the content</a></div>
<div class="authorshomeLink"><a>Test Author</a></div>
<div>sample body content.sample body content.sample body content.sample body content.sample body content.</div>
<div class="perspectiveReadurl"><a>Read More</a></div>
</div>

</div>
</div>

关于html - 用于在绝对位置显示 div 的 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41561311/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com