Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
bootstrap-margin-grid
Advanced tools
bootstrap-margin-grid.css
to your project and use classes.bootstrap-margin-grid.scss
to your project and generate columns based on simple fractions on-the-fly.Works with same markup as Bootstrap:
<div class="container">
<div class="row">
<div class="col-4">...</div>
<div class="col-4">...</div>
<div class="col-4">...</div>
</div>
</div>
...except it produces margins instead of padding.
Want background color on rows? Wrap your row in an element and apply bg color to it. This sucks but is still better than nesting a superfluous element inside of every single column.
<div class="container">
<div class="bg">
<div class="row">
<div class="col-4">...</div>
<div class="col-4">...</div>
<div class="col-4">...</div>
</div>
</div>
</div>
.bg {
background: tomato;
}
* If this gets any attention I'll match these to Bootstrap's mixins.
.custom-container {
@include container($max-width: 0, $padding: $grid-gutter-width);
}
.custom-row {
@include row();
}
.custom-column {
@include column(1, 2); // produces a column that takes up 1/2 its row
}
With padding-based grids (Boostrap, Foundation, etc.) if you want background color on rows, you need to nest an element inside each column.
This bloats markup quickly, especially when you need nested grids. For instance, a 2-column grid with a 2-column grid inside of one of the columns (not a crazy thing to want) looks like this with Bootstrap's grid:
<div class="container">
<div class="row">
<div class="col-sm-6">
<div>1</div>
</div>
<div class="col-sm-6">
<div>
<div class="row">
<div class="col-sm-6">
<div>1a</div>
</div>
<div class="col-sm-6">
<div>1b</div>
</div>
</div>
</div>
</div>
</div>
</div>
Notice all the superfluous <div>
s. This also still leaves row's overhanging their parent.
Can you imagine how insane this gets when you have real world project?
Here's a margin-based approach.
<div class="container">
<div class="bg">
<div class="row">
<div class="col-6">1</div>
<div class="col-6">
<div class="bg">
<div class="row">
<div class="col-6">1a</div>
<div class="col-6">1b</div>
</div>
</div>
</div>
</div>
</div>
</div>
https://youtu.be/ueZ6tvqhk8U?t=18
Less markup, better results, same markup scheme. There's no reason Bootstrap shouldn't switch over to margin grids.
I haven't tested to see if this is a drop-in replacement to Bootstrap's grid system. In fact, I'm pretty sure it's not. If this project gets popular I'll match all this stuff to Bootstrap perfectly so you actually can drop-in replace (assuming Bootstrap isn't heavily coupled to their padding-based grid -- lemme know if it is).
FAQs
Bootstrap's grid with margins.
We found that bootstrap-margin-grid demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.