1

I'm a new user so I really don't know how to do this.

I want to create a template that displays the results of a "news" type entry in alternating rows - image on left/text on right - image on right/text on left.

Could someone help in explaining where to put the code and what the code should be?

3

Personally I'd do this in pure CSS. e.g.,

<div class="item">
    <img ... />
    <div class="text">
        ...
    </div>
</div>
<div class="item">
    <img ... />
    <div class="text">
        ...
    </div>
</div>

CSS:

.item {
    overflow: hidden; // expand around floated children
}
img {
    float: left; width: 50%;
}
.text {
    float: right; width: 50%;
}

.item:nth-of-type(2n) img {
    float: right;
}
.item:nth-of-type(2n) .text {
    float: left;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.