Php 相对Div内有绝对Div的响应高度
我正在做一个关于页面。我已将每个人的照片设置为相对定位div内的绝对。绝对定位div包含两张相互叠放的照片,当您悬停时,将显示该人的备用照片。相对定位div还包含此人的姓名和电子邮件 它也是流动的。因此,我将相对div的宽度设置为100%,并且图像的大小可以通过浏览器流畅地调整。我的问题是高度保持不变,我无法让它用浏览器响应。我试过将高度设置为100%,但这不是诀窍 非常感谢您的帮助 这是我的html:Php 相对Div内有绝对Div的响应高度,php,html,css,height,Php,Html,Css,Height,我正在做一个关于页面。我已将每个人的照片设置为相对定位div内的绝对。绝对定位div包含两张相互叠放的照片,当您悬停时,将显示该人的备用照片。相对定位div还包含此人的姓名和电子邮件 它也是流动的。因此,我将相对div的宽度设置为100%,并且图像的大小可以通过浏览器流畅地调整。我的问题是高度保持不变,我无法让它用浏览器响应。我试过将高度设置为100%,但这不是诀窍 非常感谢您的帮助 这是我的html: <section class="team clearfix"> <?php
<section class="team clearfix">
<?php
$custom_query = new WP_Query( array( 'post_type' => 'team', 'orderby' => 'title', 'order' => 'ASC' ));
while($custom_query->have_posts()) : $custom_query->the_post(); ?>
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<div class="inner">
<div class="image-container">
<?php
$image2 = get_field('alt_photo');
if( $image2 ): ?>
<img class="bottom" src="<?php echo $image2['url']; ?>" alt="<?php echo $image2['alt']; ?>" title="<?php echo $image2['alt']; ?>">
<?php endif; ?>
<?php
$image = get_field('main_photo');
if( $image ): ?>
<img class="top" src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" title="<?php echo $image['alt']; ?>">
<?php endif; ?>
</div>
<div class="entry-summary">
<h2 class="entry-title"><?php the_title(); ?></h2>
<?php
if(get_field('email')) { ?>
<a href="mailto:<?php echo get_field('email'); ?>">email</a>
<?php } ?>
</div>
<?php //the_content(); ?>
</div>
</article>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
</section>
您是否尝试过
max height
?试试max height:100%
,看看这是否也有效。请创建一个JSFIDLE,这样我们可以帮助您更快地完成工作。Hi@Paulie\u D这里是指向网站的链接:eightsevencentral.com/aboutNope…不是链接…简化的JS FIDLE。我们不能在你的整个HTML/CSS中找到一个小小的缺陷。
section.team .image-container {
position: relative;
margin: 0 auto;
width: 100%;
height: 512px;
}
section.team .image-container img{
position: absolute;
left:0;
-webkit-transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-o-transition: opacity .5s ease-in-out;
transition: opacity .5s ease-in-out;
}
section.team .image-container img.top:hover{
opacity:0;
}
section.team {
padding: 30px 0;
text-align: center;
padding-left: 10px;
padding-right: 10px;
}
section.team .hentry {
float: left;
position: relative;
padding-left: 10px;
padding-right: 10px;
margin-bottom: 20px;
}
section.team .hentry .entry-summary {
min-height: 50px;
}
section.team .hentry .entry-summary .entry-title {
font-family:'Avenir LT W02 95 Black', "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: normal;
font-size: .75em; /* 12px */
line-height: 1em; /* 14px */
letter-spacing: .2em;
margin-bottom: 0;
text-transform: uppercase;
}
section.team a {
font-size: 12px;
}