How to write function in css
I know that possible with SCSS
For example in SCSS you do like this
Is their any way with which i can achieve this in css
I am using php as my language
@mixin table-base {
th {
text-align: center;
font-weight: bold;
}
td, th {padding: 2px}
}
@mixin left($dist) {
float: left;
margin-left: $dist;
}
#data {
@include left(10px);
@include table-base;
}
The answer is No.
CSS is not a programming language. It does not have functions. It really isn’t designed to be used this way at all.
Whatever problem it is that you’re trying to solve by wanting to write CSS functions, there is almost certainly a better way to achieve it.