Git Product home page Git Product logo

Comments (10)

LeiChat avatar LeiChat commented on May 14, 2024 2

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

capture1

EDIT: I added margin-top: 0px; to .checkbox input[type="checkbox"]:checked + label::after

from awesome-bootstrap-checkbox.

tvdeyen avatar tvdeyen commented on May 14, 2024 1

If the line-height is higher then normal, the vertical alignment is broken:

brand eins kiosk - brand eins kiosk 2016-02-05 15-15-44

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.

ylv-io avatar ylv-io commented on May 14, 2024 1

Any solutions for pure css?

from awesome-bootstrap-checkbox.

alexanderpepper avatar alexanderpepper commented on May 14, 2024 1

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.

alexanderpepper avatar alexanderpepper commented on May 14, 2024 1

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.

DimaSavchenko avatar DimaSavchenko commented on May 14, 2024

Hi. Could you give the screenshot, please? So we can better understand your problem.

from awesome-bootstrap-checkbox.

malterb avatar malterb commented on May 14, 2024

Running into the same issue: The vertical alignment of text is off

Image of Alignment issue

from awesome-bootstrap-checkbox.

mahendhar9 avatar mahendhar9 commented on May 14, 2024

Thank you @tvdeyen, it works!

from awesome-bootstrap-checkbox.

mrdnote avatar mrdnote commented on May 14, 2024

I'm having the same problem as @LeiChat

from awesome-bootstrap-checkbox.

LeiChat avatar LeiChat commented on May 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.