带有突出显示的单元格的表

时间:2016-02-18 19:42:40

标签: php html css wordpress

我正在尝试使用wordpress创建一个博客,我偶然发现了一个错误。我的页面水平显示页面,预览文本很糟糕。我该如何解决? 这是我的index.php的一个片段:     

<div id="wrapper">
<table class="centerTable">
<tr>

<?php $the_query = new WP_Query( 'posts_per_page=5' ); ?>

<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>

<th><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></th>

<th><?php the_excerpt(__('(more…)')); ?></th>

<?php
endwhile;
wp_reset_postdata();
?>
</tr>
</table>
</div>

<?php get_footer(); ?>

这是style.css:

.centerTable {

margin-left: auto ;
margin-right: auto ;
background-color: white;
-webkit-border-radius:10px;
-moz-border-radius:10px;
position: center;
width: 550px;
font-family: 'Shift', sans-serif;
}
.centerTable tr, th, td {
color: #444;
font-size: 16px;
font-family: 'Shift', sans-serif;
transition: .4s background-color;}

.centerTable th, tr {
padding:3px 6px; font-weight:normal; 
color:#000;
}

.centerTable th:hover {
background-color: #ffa500;
color: white;
}
你能帮帮我吗?我希望我的页面和预览文本在另一个下面(就像一个包含2列和多行的表格)。

1 个答案:

答案 0 :(得分:0)

为什么不给出最大宽度尺寸来表&#34;表&#34;和&#34; tr&#34;和CSS盒子模型一样工作吗?