The site implemented the issuance of goods from the database, where there is a picture, name and description. All in one block: the picture on the left side, and the name and description on the right side.
@foreach (var p in @Model.Gdss) { @Html.Partial("GdsSummary", p) } Here is the GdsSummary :
<section class="textblock"> <div class="wrap"> <div class = "pic"> @if (Model.ImageData != null) { <img src="@Url.Action("GetImage", "Gds", new { Model.GdsId })" /> } </div> <div class="gds"> <h2>@Model.Name</h2> <p>@Model.Description</p> </div> </div> </section> I would like to do the following: for example, there are 7 products in the database. It is necessary that each even change the position of the picture ( class="pic" ) and descriptions ( class="gds" ) i.e. so that on 2, 4 and 6 products the picture and description are reversed.
In CSS, there is a nth-child selector. Is it possible for them to realize their plans and how? Is it possible to somehow indicate that he changes the <div class = "pic"> and <div class="gds"> in this textblock ? If this does not work out, then how is it possible in principle to interchange the picture and description on even elements?
Thank you in advance for your reply!