Home > Net >  Can't change width or height in electron
Can't change width or height in electron

Time:08-29

I'm making a electron application and trying to make a div a certain size, but it doesn't work.

I try putting width and height, but it doesn't set the width or height to what I set as the height, I tried looking in the DevTools, but it had a warning symbol.

My CSS looks like this:

.price {
    background-color: #272525;
    color: white;
    width: 128; /* Doesn't work */
    height: 128; /* Doesn't work */
}

CodePudding user response:

Its undefined because the value (128) is not defined whether it's pixels, rem.. etc. Try changing it to

width: 128px; height: 128px;

CodePudding user response:

Add px after the number in the height and with properties. You can use others like em, rem, %, vw, vh

  • Related