[css] Calculating width from percent to pixel then minus by pixel in LESS CSS

I will calculate width in some element from percent to pixel so I will minus -10px via using LESS and calc(). It´s possible?

div {
    span {
        width:calc(100% - 10px);
    }
}

I using CSS3 calc() so it doesn't work: calc(100% - 10px)

Example: if 100% = 500px so width = 490px (500-10);

I made a demo for testing : http://jsfiddle.net/4DujZ/55/

so padding will say: 5 (10px / 2) all the time when I resizing.

Can I do it in LESS? I know how to do in jQuery and simple CSS like margin padding or else... but i will try to do functional in LESS with calc()

This question is related to css less pixel

The answer is


I think width: -moz-calc(25% - 1em); is what you are looking for. And you may want to give this Link a look for any further assistance


Try this :

width:auto;
margin-right:50px;

Or, you could use the margin attribute like this:

    {
    background:#222;
    width:100%;
    height:100px;
    margin-left: 10px;
    margin-right: 10px;
    display:block;
    }

Examples related to css

need to add a class to an element Using Lato fonts in my css (@font-face) Please help me convert this script to a simple image slider Why there is this "clear" class before footer? How to set width of mat-table column in angular? Center content vertically on Vuetify bootstrap 4 file input doesn't show the file name Bootstrap 4: responsive sidebar menu to top navbar Stylesheet not loaded because of MIME-type Force flex item to span full row width

Examples related to less

Bootstrap fixed header and footer with scrolling body-content area in fluid-container Is it possible to use vh minus pixels in a CSS calc()? "Please try running this command again as Root/Administrator" error when trying to install LESS How to use font-awesome icons from node-modules Double border with different color Disable LESS-CSS Overwriting calc() Use table row coloring for cells in Bootstrap Understanding Bootstrap's clearfix class How to use if statements in LESS Calculating width from percent to pixel then minus by pixel in LESS CSS

Examples related to pixel

c++ and opencv get and set pixel color to Mat Calculating width from percent to pixel then minus by pixel in LESS CSS Count all values in a matrix greater than a value Get pixel's RGB using PIL What's the best way to set a single pixel in an HTML5 canvas? Converting pixels to dp Setting width/height as percentage minus pixels How to get screen dimensions as pixels in Android Convert Pixels to Points How to read the RGB value of a given pixel in Python?