-
Notifications
You must be signed in to change notification settings - Fork 223
Incorrect Responsive Grid Layout with Padding #189
Comments
Try this in latest Sciter and browser <html>
<head>
<title>Bootstrap test</title>
<style>
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
margin: 0;
font-size: 16px;
color: #212529;
text-align: left;
background-color: #fff;
}
div.row {
outline: 1px solid red;
outline-offset: -1px;
}
div.row > div {
outline: 1px solid blue;
outline-offset: -1px;
}
/* for browser */
@supports (display:grid) {
.container {
width: 100%;
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
max-width: 540px;
}
.row {
display: flex;
flex-wrap: wrap;
margin-right: -15px;
margin-left: -15px;
}
.col-4, .col-8 {
position: relative;
width: 100%;
padding-right: 15px;
padding-left: 15px;
}
.col-4 {
flex: 0 0 33.333333%;
max-width: 33.333333%;
}
.col-8 {
flex: 0 0 66.666667%;
max-width: 66.666667%;
}
}
@supports (flow:horizontal) { /* sciter */
body { horizontal-align: center; }
.container { width: 1*; }
@media (min-width == 576px) {
.container, .container-sm {
max-width: 540px;
}
}
.row { flow:horizontal-wrap; width:1*; }
.col-4 { width: 0.33*; }
.col-8 { width: 0.67*; }
}
</style>
<script type="text/tiscript">
function self.ready() {
view.mediaVars
{
min-width: 576px,
};
}
</script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-8">col-8</div>
<div class="col-4">col-4</div>
</div>
</div>
</body>
</html> And check specification: This https://sciter.com/developers/for-web-programmers/ may also be helpful. |
@c-smile, thank you for your sample code, but, unfortunately, proposed solution doesn't wrap columns as it should. You could check your code with little modification (in browser and in Sciter), just duplicate <body>
<div class="container">
<div class="row">
<div class="col-8">col-8</div>
<div class="col-4">col-4</div>
<div class="col-4">col-4</div>
</div>
</div>
</body> This will add one additional Result in browserCorrect and expected behaviour in browser: Result in SciterSciter just adds another column which exceeds 100% but is shown unwrapped, on the same line, incorrect result: |
Just add min constraint: .col-4 { width: 0.33*; min-width:200px; }
.col-8 { width: 0.67*; min-width:200px; } Or if you want to have exactly two elements per row then do div.row > :nth-child(2n) { clear:after; } |
Andrew, I really appreciate your help, but I see several issues in your approach. IntentionsI'll try to clarify my intentions:
Proposed solutionsBut what I see in your answers:
ProblemThe main problem is: current flow/flex implementation in Sciter doesn't allow to use HTML-compatible logic (not exact code, only logic) without hard-coded workarounds. It's important to normalise and synchronise Sciter logic with modern browser logic in internal width calculation (with paddings) to make it more consistent. This will allow to port real html code (e.g. Bootstrap) more seamlessly. ProposalIf you haven't enough time to implement this, I could help you with your code. |
So add padding. I've removed it to simplify the test.
It could be anything,
That's just an idea, as I said I don't know what your final goal is. Are you trying to solve some concrete task or just testing how it can be done in general? I do not have plans to implement |
Yet I have plans to Open Source Sciter.JS next year so you will be able to try to implement display:flex there. |
My goal is to port Bootstrap to Sciter while keeping intact Bootstrap logic. |
Incorrect Responsive Grid Layout with Padding
Overview
Sciter incorrectly calculates container width, so it's impossible to get correctly displayed responsive layout.
It looks like a bug, or I just misunderstand Sciter implementation.
Detailed
Currently I'm porting latest Bootstrap to Sciter with mixed success.
Overall progress is very promising, but I failed with responsive grid layout of
container
,row
andcol
(column) implementations.Expected result
Proof
Browser Result
Sciter Result
How to reproduce
Browser
flex-html.htm
into any modern browsercol-8
should be followed bycol-4
in the same row (line).Sciter
flex-sciter.htm
into Sciter test app (usciter
).HTML Code
Sciter Code
Sciter Version
System
Request for detailed information
flex
and HTML'sflex
in detail.The text was updated successfully, but these errors were encountered: