I want to achieve something like this:
Here's what, I am currently getting in Bootstrap:
I want to achieve the following:
- Width ratios must be such that
Sites : User : Download = 2:8:2
Sites-Banner
,Sites-Search
,Download-Banner
,Download-Summary
all should have same heightsUser-Login
must have combined height ofSites-Banner
&Sites-Search
(orDownload-Banner
&Download-Summary
)- Heights of
Sites-List
,User-Operations
,Download-Details
must be independent and can extend as long as required.
Here's my code: Fiddle (Check Update 1)
<div>
<div class="row">
<div class="col-2">
<div class="row">
<div class="col bg-primary">
<p id="sites-banner">Sites Banner</p>
</div>
</div>
<div class="row">
<div class="col bg-secondary">
<p id="sites-search">Sites Search</p>
</div>
</div>
<div class="row">
<div class="col bg-success">
<p id="sites-list">Sites List</p>
</div>
</div>
</div>
<div class="col-8">
<div class="row">
<div class="col bg-danger">
<p id="user-login">User Login</p>
</div>
</div>
<div class="row">
<div class="col bg-warning">
<p id="user-operations">User Operations</p>
</div>
</div>
</div>
<div class="col-2">
<div class="row">
<div class="col bg-info">
<p id="downloader-banner">Download Banner</p>
</div>
</div>
<div class="row">
<div class="col bg-light">
<p id="download-summary">Download Summary</p>
</div>
</div>
<div class="row">
<div class="col bg-dark">
<p id="download-details">Download Details</p>
</div>
</div>
</div>
</div>
</div>
- I am not able to align the height of
User-Login
withSites-Banner
&Sites-Search
[Done : Update 1] Sites-List
,User-Operations
&Download-Details
do not extend independently
Update 1: New Code
- I got the
User-Login
to have combined height ofSites-Banner
&Sites-Search
, by wrapping them in a singlerow
(<div class="row">
) - But I am still not able to get the heights of
Sites-List
,User-Operations
,Download-Details
to be independent.
Update 2: New Code
- Got the heights of
Sites-List
,User-Operations
,Download-Details
to be look independent. - But the there's lot of padding in between columns, which introduces white space in between and makes them look not aligned
Update 3: Fiddle
Although in Update 2 code it may look like that Sites-List
, User-Operations
& Download Details
have different heights, they actually do not. They look so since we have applied background-color classes only to div
element that contains the list.
For the issue regarding padding in between columns that can be solved by applying a mx-0
class attribute on the two rows, to make margin as 0
Rows have a negative margin of -15 px
by default.
Checkout: Bootstrap negative margin on rows
Without mx-0
would cause a horizontal scrollbar on page. Checkout: Bootstrap columns cause horizontal scrollbar
Summary:
- Treat
row
&col
as Table'str
andtd
- Always put content in
col
- A
col
should necessarily haverow
as parent. Checkout: Bootstrap Grid Working & Guidlines