问题在于news4 div
的宽度为30%。它必须是50%。看起来nth-of-type
也会计算.advertisement div
和news4 div
成为第五个子元素。 nth-of-type
和nth-child
也是如此。
我的html示例是:
<div class="container">
<div class="news">news1</div>
<div class="news">news2</div>
<div class="news">news3</div>
<div class="advertisement">Advertisement</div>
<div class="news">news4</div>
<div class="news">news5</div>
<div class="news">news6</div>
</div>
和css:
.container { width: 100%; }
.news:nth-of-type(3n+1) { width: 50%; }
.news:nth-of-type(3n+2) { width: 30%; }
.news:nth-of-type(3n+3) { width: 20%; }
答案 0 :(得分:1)
ERROR_REPORTING(E_ALL);
require_once('../MailQueue.class.php');
$queue = new MailQueue();
$currentTime = date('YmdHis');
$try = 50;
$data = Array();
for($i=1; $i<=3; $i++) {
$data[$i] = Array();
$data[$i]['sendAt'] = date('Y-m-d H:i:s');
$data[$i]['fromName'] = 'John Doe '.$i;
$data[$i]['fromAddress'] = 'john@doe.com';
$data[$i]['toName'] = 'Jane Doe';
$data[$i]['toAddress'] = 'jane@doe.com';
$data[$i]['subject'] = 'Test message MailQueue '.$currentTime;
$data[$i]['body'] = 'Test message MailQueue '.$currentTime;
}
// Directly process the added messages
echo "Trying to send ".$try." emails.<br />";
$counter = $queue->processQueue($try, $queue->add($data));
echo "Added 3 new emails to be sent. ".$counter." emails were actually sent.";
是指元素标记(nth-of-type
),而不是类名(div
)。
如果您想在.news
之后定位.news
项目,可以考虑以下选择器:
.advertisement