<div class="newstitle">
<ul class="newstitle">
@foreach (var item in Model.Content)
{
if (item.Value != null)
{
<li>
<div class="newstitle_title">@item.Key.Name</div>
</li>
}
}
</ul>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('.newstitle li:nth-child(odd)').addClass('last');
});
</script>
I have this code, i ve been trying to run and it s breaking the css.

However, it should be like the following, please see the spacing between images:

how can i fix this? if you see there is both div and ul has the same class name.
This is what the generated html should be:
<div class="newstitle">
<ul class="newstitle">
<li>image</li>
<li>image</li>
<li>image</li>
<li class="last">image</li>
<li>image</li>
<li>image</li>
<li>image</li>
<li class="last">image</li>
<li>image</li>
<li>image</li>
<li>image</li>
<li class="last">image</li>
</ul>
</div>
and here is the css:
.newstitle {width:600px;overflow:hidden;margin:15px auto;}
.newstitle li {float:left;width:140px;height:170px;overflow:hidden;margin:0px 13px 0px 0px;display:inline;position:relative;}
.newstitle .last {float:left;width:140px;height:170px;overflow:hidden;margin:0px 0px 0px 0px;display:inline;position:relative;}
Try this :
FIDDLE