Arrange cards left and right using BS4, no parent columns
Using Bootstrap 4 and without Javascript, how can I create a layout like this when the viewport is large:
And such a situation when the viewport is limited:
The only way I could have looked like a large viewport layout was as follows:
<div class="row justify-content-center">
<div class="col-8 column-1">
<form class="card text-center" action="runthis" method="GET">
<div class="card-header">Hello</div>
<div class="card-block">
<input type="text" class="form-control input-lg" name="full_name" placeholder="Full Name" autofocus="" />
<input type="text" class="form-control input-lg" name="full_name2" placeholder="Full Name/>
<input type=" text " class="form-control input-lg " name="full_name3 " placeholder="Name " />
<button name="Submit " value"submit " class="btn btn-primary ">Submit</button>
</div>
</form>
</div> <!-- end column-1 -->
<div class="col-4 column-2">
<div class="card p-3">
<blockquote class="card-block card-blockquote">
<h4 class="card-title ">Card title</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
</blockquote>
</div>
<div class="card">
<div class="card-block ">
<h4 class="card-title ">Card title 2</h4>
<p class="card-text ">This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text "><small class="text-muted ">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
</div>
This code can be seen at https://codepen.io/anon/pen/ZKoPWx
As you can see from the above code, it does not allow anti-aliasing when desired when the viewport is limited due to the parent columns of the left and right sections.
How can I do this without parent columns?
+3
source to share
1 answer
Use the new BS 4 utility classes to float columns appropriately on large screens. They will then stack naturally on smaller (xs) screens.
https://www.codeply.com/go/A6F3GT1xw8
<div class="container-fluid">
<div class="row d-block">
<div class="col-sm-4 float-sm-right">
<div class="card p-3">
card 2
</div>
</div>
<div class="col-sm-8 float-sm-left">
<form class="card text-center" action="runthis" method="GET">
card 1
</form>
</div>
<div class="col-sm-4 float-sm-left">
<div class="card">
<div class="card-block ">
card 3
</div>
</div>
</div>
</div>
</div>
+1
source to share