Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8922967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:59:02+00:00 2026-06-15T06:59:02+00:00

I am working on a mvc 4 web application. I am a newbie (just

  • 0

I am working on a mvc 4 web application. I am a newbie (just started a few days ago, so please be good to me).

So I have managed to get data from a Repository class into a View. No problem here. But the problem is that I want to make it so that this data is displayed horizontally, in two columns with two blocks in each column. So far the data is being laid out vertically, top to bottom.

<div id="myID">
    @foreach(var stuff in Model)
    {
        <article>@stuff.title</article>
    }
</div>

The above code is a simplified version of what I have going on. But again, the data is shown just like list, top to bottom display, and I want the data to be displayed like this:

A  B
C  D

Any help will be very appreciated.

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:59:03+00:00Added an answer on June 15, 2026 at 6:59 am

    One way you could achieve your goal (without using nasty tables) is to use CSS to layout your articles.

    A simpler way to explore such HTML related issues is to create a simple HTML page containing just the elements you’re looking for:

    <!DOCTYPE html>
    
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style>
            div#articles {
                width: 450px;
                border: solid 1px red; /* For debugging purposes */
            }
    
            div#articles article{
                display: inline-block;      /* Force the article to be displayed in a rectangular region laid out next to one another */
                margin: 5px;                /* Leave a little room between each article */ 
                width: 200px;               /* Limit the maximum width of the article so that only two fit side-by-side within the div */
                text-align: center;         /* Center the text horizontally */
                vertical-align: middle;     /* Center the text vertically */
                border: solid 1px green;    /* For debugging purposes - so you can see the region the articles live within */
            }
        </style>
    </head>
    <body>
        <div id="articles">
            <article>Article A</article>
            <article>Article B</article>
            <article>Article C</article>
            <article>Article D</article>
        </div>
    </body>
    </html>
    

    Articles, paragraphs and the like are normally laid out as flowed elements sized to the width of the element that contains them (the DIV in your example).

    You want your articles to be laid out in a grid-like pattern and so you need to tell the browser to render these particular elements as “block”s. Furthermore, you want the blocks flowed within their parent such that only two blocks can fit side-by-side within the containing DIV.

    So, using CSS styling you can:
    1. Set your DIV’s width to a fixed size
    2. Set your articles to be rendered as “inline-block” style
    3. Set your articles’ width so only two can fit on each row
    Optionally:
    4. Center your articles’ text if necessary
    5. Set your articles’ margins to leave a little room between each one
    6. To better see the regions within which each element lives, use a simple 1px colored border

    This approach results in the following layout:
    enter image description here

    HTH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get client validation working on my asp.net mvc 2 web application
I have a working ASP.NET MVC web application to manage projects and customers. Now
I'm working on a Spring MVC 3 web application, I have some JSPs that
I am working on an asp.net MVC 3 web application, i have the following
I'm working on an MVC .Net web application . I have a database in
i'm working on a simple spring mvc web application i have : a simple
I am working on an asp.net mvc 3 web application , and i have
I'm working on an intranet MVC web application, using Fluent NHibernate. As everyone knows,
I'm currently working on an Asp.net MVC Web application. In my solution, there're two
I'm working on a Java web application (Adobe Flex front-end, JPA/Hibernate/BlazeDS/Spring MVC backend) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.