Search
 
SCRIPT & CODE EXAMPLE
 

CSS

How to do addition or subtraction on CSS Variables?

:root {
  --margin: 50px;
  --margin--: calc(var(--margin) * -1));
 /* 
 while you may simply write like below
 but I love to use as above 
 coz, we'll only need to change value 
 in one place if needed
 */
 /* --margin--: -50px; */
}

.positive-margin {
  margin: var(--margin);
}
.negative-margin {
  margin-left: var(--margin--);
}
Comment

How to do addition or subtraction on CSS Variables?

:root {
  --margin: 50px;
}

body {
  margin: 0 100px;
  border:1px solid;
}

.box-1 {
  background: red;
  height: 100px;
  width: 200px;
  margin-left: calc(-1 * var(--margin));
}

.box-2 {
  background: green;
  height: 100px;
  width: 200px;
  margin-left: calc(-1 * (-1 * var(--margin))); /* You can also nest calculation */
}
Comment

PREVIOUS NEXT
Code Example
Css :: kdenlive blurry vertical background 
Css :: how to add a selection in css 
Css :: french bakery northgate 
Css :: slick cuted shadow 
Css :: mount file share linux windows ubuntu 
Css :: resizer in vertical 
Css :: <asp:FileUpload ID="Fu_Result" runat="server" Width="250px" CssClass="inputfile" / 
Css :: less css file extension 
Css :: linear gradient 
Css :: how to put an element in the center css 
Css :: edit input field css 
Css :: print css media query 
Css :: css div hexagon 
Css :: horizontal dotted progress library 
Typescript :: typescript react onchange event type 
Typescript :: mat-select change event 
Typescript :: install typescript 
Typescript :: get posts from selected taxonomy 
Typescript :: how to add a new propety into all documents in mongodb 
Typescript :: typescript canvas 
Typescript :: how to remove the dots from ul 
Typescript :: onblur typescript 
Typescript :: serenity.-is add column picker button 
Typescript :: highcharts cdn links 
Typescript :: ts class without implementation 
Typescript :: keyboard events pygame 
Typescript :: cmd check if folder exists or not 
Typescript :: ts class static function call inside class extends 
Typescript :: throw error in typescript 
Typescript :: wordpress get post attachments url 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =