gpt4 book ai didi

css - 我的设计有两列,右边在右边但在左列下方。为什么?

转载 作者:行者123 更新时间:2023-11-28 08:04:47 25 4
gpt4 key购买 nike

我的设计有两列 .leftcolumn.rightcolumn。它们应该在我的设计中彼此相邻,它们应该是左右两侧,但是 .rightcolumn 在右侧的 .leftcolumn 下方.为什么?

CSS:

.coursecontent {
width: 1200px;
}
.leftcolumn{
width: 860px;
float: left;
border-right-style: solid;
border-right-width: 2px;
border-right-color: #efefef;
}
.rightcolumn{
float: right;
width: 300px;
}

页面:

<!DOCTYPE html>
<html>
<?php
/**
* Template Name: Single event template
*/
get_header(); ?>
<div class="coursecontent">
<div class="leftcolumn">
<?php while ( have_posts() ) : the_post(); ?>
<h1> <?php the_title(); ?> </h1>
</br> <?php
echo '<div class="tagsremove">';
global $post;
$nextTagThumb='-1';
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag) :
if ($tags) {
$what_tag = $tags[($nextTagThumb+'1')]->term_id;
$args=array(
'tag__in' => array($what_tag),
'post__not_in' => array($post->ID),
'showposts'=>100,
'caller_get_posts'=>1
); ?>
<div class="tags_course_single">
<h5> Similar courses: </h5>
<?php $my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php echo get_permalink(); ?>"> <?php the_title(); ?></a>,
<?php endwhile;
}
wp_reset_query();
$nextTagThumb = ($nextTagThumb+1);
}
endforeach;
?> </div> <br />
<?php echo '</div>'; ?>
<div class="imageandtext">
<div class="mainimage">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail();} ?>
</div>
<?php the_content(); ?>
</div>
<?php endwhile; ?>
</div>
<div class="rightcolumn">
<div class="countersingle">
<h4> When this course starts: </h4>
<h6> (there maybe more than one possible start date) </h6>
<?php
$count = 0;
$your_repeater = get_field('add_date');
if($your_repeater){
while( have_rows('add_date') ): the_row();
$count++;
$my_field = get_sub_field('course_date');
if ($count == 1) {
$todays_date = date("Y-m-d");
$today = strtotime($todays_date);
$expiration_date = strtotime($my_field);
if ($expiration_date > $today) {
$date12 = new DateTime($my_field);
$date13 = new DateTime($todays_date);
$diff=date_diff($date12,$date13);
echo '1. ' . $my_field ;
echo '<div class="reddays"> in '. $diff->format("%R%a days.") .'<a href="'.get_page_link('10') .'"> Contact us now</a></div>';
} else {
echo '' ;
} }
if ($count == 2) {
$todays_date = date("Y-m-d");
$today = strtotime($todays_date);
$expiration_date = strtotime($my_field);
if ($expiration_date > $today) {
$date12 = new DateTime($my_field);
$date13 = new DateTime($todays_date);
$diff=date_diff($date12,$date13);
echo '2. ' .$my_field ;
echo '<div class="reddays"> in '. $diff->format("%R%a days.") .'<a href="'.get_page_link('10') .'"> Contact us now</a></div>';
} else {
echo '' ;
}}
if ($count == 3) {
$todays_date = date("Y-m-d");
$today = strtotime($todays_date);
$expiration_date = strtotime($my_field);
if ($expiration_date > $today) {
$date12 = new DateTime($my_field);
$date13 = new DateTime($todays_date);
$diff=date_diff($date12,$date13);
echo '3. ' .$my_field ;
echo '<div class="reddays"> in '. $diff->format("%R%a days.") .'<a href="'.get_page_link('10') .'"> Contact us now</a></div>';
} else {
echo '' ;
} }
if ($count == 4) {
}
if ($count == 5) {
}
echo '</ul>';
endwhile;
}?>
</div>
<div class="mathsandenglish">
<h4> Improve your maths and English at the same time </h4>
<?php $key_1_value = get_post_meta( get_the_ID(), 'twitter_embed', true );
if( ! empty( $key_1_value ) ) {
echo $key_1_value; } ?>
</div>
</div>
</div>
<?php get_footer(); ?>
</html>

最佳答案

在你的foreach ($tags as $tag) :在左栏循环你打开一个<div class="tags_course_single">但你没有关闭它,看起来你正试图在循环后关闭它,endforeach; ?> </div>所以我会移动那个 </div>$nextTagThumb = ($nextTagThumb+1);之后在你的循环中。

还有一个 </br>那应该是 <br />在顶部附近:)

你也没有 <head>标记在你的 html 中,所有其他东西应该在 <body> 中标签。

关于css - 我的设计有两列,右边在右边但在左列下方。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29548844/

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