Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Make it so that columns are always on one row

When the screen is big, everything is how it’s supposed to look. The problem comes when you are using a phone. I would like these two columns to ALWAYS be on one row, but right now if you are on mobile the columns will stack. How can I make it so that they just resize and stay on one row no matter the size of the screen? I would like the first column(left one) to be the one that gets resized.

    <div class="container">
        <div class="row">
        <div class="col-lg-8">
            <div class="form-group mb-3">
                <label asp-for=Title></label>
                <input readonly class="form-control form-control-lg" asp-for=Title placeholder="Title"/>
            </div>
            <div class="form-group mb-3">
                <label asp-for=Description></label>
                <textarea readonly class="form-control" asp-for=Description rows="3"></textarea>
            </div>
            <div class="form-group mb-3">
                <label asp-for=Price></label>
                <input readonly class="form-control" asp-for=Price/>
            </div>
            <div class="form-group mb-3">
                <label asp-for=Location></label>
                <input readonly class="form-control" asp-for=Location/>
            </div>
            <div class="form-group mb-3">
                <label asp-for="CategoryName"></label>
                <input readonly class="form-control" asp-for="CategoryName" />
            </div>
            <div class="form-group mb-3">
                <label asp-for="DateCreatedOn"></label>
                <input readonly class="form-control" asp-for="DateCreatedOn" />
            </div>
        </div>
        <div class="col-lg-4">
            <div class="container">
                <div class="card border border-primary rounded p-0 mb-3 mx-1">
                    <div class="card-body">
                        <img id="image1" src="@profilePictureSrc" class="card-img">
                    </div>
                    <div class="card-footer text-center">
                        <input readonly class="form-control text-center" asp-for="UserName"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Assuming you are using bootstrap, according to https://getbootstrap.com/docs/5.1/layout/grid/ you just have to change from lg to the breakpoint you want

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
  <div class="row">
    <div class="col-8">
      <div class="form-group mb-3">
        <label asp-for=Title></label>
        <input readonly class="form-control form-control-lg" asp-for=Title placeholder="Title" />
      </div>
      <div class="form-group mb-3">
        <label asp-for=Description></label>
        <textarea readonly class="form-control" asp-for=Description rows="3"></textarea>
      </div>
      <div class="form-group mb-3">
        <label asp-for=Price></label>
        <input readonly class="form-control" asp-for=Price/>
      </div>
      <div class="form-group mb-3">
        <label asp-for=Location></label>
        <input readonly class="form-control" asp-for=Location/>
      </div>
      <div class="form-group mb-3">
        <label asp-for="CategoryName"></label>
        <input readonly class="form-control" asp-for="CategoryName" />
      </div>
      <div class="form-group mb-3">
        <label asp-for="DateCreatedOn"></label>
        <input readonly class="form-control" asp-for="DateCreatedOn" />
      </div>
    </div>
    <div class="col-4">
      <div class="container">
        <div class="card border border-primary rounded p-0 mb-3 mx-1">
          <div class="card-body">
            <img id="image1" src="https://picsum.photos/200" class="card-img">
          </div>
          <div class="card-footer text-center">
            <input readonly class="form-control text-center" asp-for="UserName" />
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading