Comments (10)
I've added the fix @tvdeyen advised which aligned the label text with the box, thank you, but I have some issues with the location of the tick. I'm using Bootstrap v3.3.7
EDIT: I added margin-top: 0px;
to .checkbox input[type="checkbox"]:checked + label::after
from awesome-bootstrap-checkbox.
If the line-height
is higher then normal, the vertical alignment is broken:
This is because of the position: absolute
of the label::before
and after
elements.
This fixes it:
@import "awesome-bootstrap-checkbox";
.radio, .checkbox {
label {
&::before, &::after { top: 50%; }
&::before { margin-top: -9px; }
&::after { margin-top: -6px; }
}
}
from awesome-bootstrap-checkbox.
Any solutions for pure css?
from awesome-bootstrap-checkbox.
Building on the answer provided by @tvdeyen, here's a pure CSS solution that also solves the issue @LeiChat identified in Bootstrap 3:
.radio label::before,
.checkbox label::before,
.radio label::after,
.checkbox label::after {
top: 50%;
}
.radio label::before,
.checkbox label::before,
.checkbox label::after {
margin-top: -9px;
}
.radio label::after {
margin-top: -6px;
}
from awesome-bootstrap-checkbox.
Here's the solution I'm using for Bootstrap 4:
.radio label::before,
.checkbox label::before,
.radio label::after,
.checkbox label::after {
top: 50%;
}
.checkbox label::before,
.radio label::before {
margin-top: -10px;
}
.checkbox label::after,
.radio label::after {
margin-top: 2px;
}
from awesome-bootstrap-checkbox.
Hi. Could you give the screenshot, please? So we can better understand your problem.
from awesome-bootstrap-checkbox.
Running into the same issue: The vertical alignment of text is off
from awesome-bootstrap-checkbox.
Thank you @tvdeyen, it works!
from awesome-bootstrap-checkbox.
I'm having the same problem as @LeiChat
from awesome-bootstrap-checkbox.
For the .radio label before and after classes I have used margin-top: 3px, rather than the -9px and -6px that @tvdeyen suggested.
from awesome-bootstrap-checkbox.
Related Issues (20)
- printing - selected radio button not visible HOT 1
- Undefined variable: "$input-border-color" in awesome-bootstrap-checkbox.scss HOT 2
- border is not pretty when focus expecially the radio box HOT 3
- Incompatibility list with bootstrap v4.0.0-beta HOT 1
- Undefined variable: "$form-check-input-gutter" HOT 3
- Not working with Asp webforms HOT 2
- Integration with bootstrap-vue HOT 1
- Checkbox click not working on 1.0.0 HOT 2
- Usage with FontAwesome v5 HOT 14
- Checkbox is not working without these specific attributes HOT 1
- Long label - prevent text from wrapping?
- Support for react-bootstrap
- :after content doesn't display on ios
- Border thickness as variable
- checkbox and radio buttons HOT 1
- Checkbox Inside table column HOT 2
- label padding-left creates a clickable area to the right of the checkbox when used in table
- Error npm install awesome-bootstrap-checkbox
- Latest version missing from npm?
- Is it normal to have indeterminate state on input radio when nothing are selected ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from awesome-bootstrap-checkbox.