is there a way to make a div not scalable?
This is my css:
.card{
margin-left:5px;
width:19%;
float:left;
}
I want the div card to stay the same width even when you scale the browser.
Use a percentage only if the container of your div element has a fixed width in pixels. Or, as Oriol told you, use a fixed width for your div
If you just set your width using px
and not %
it will max it to that width
The width
property
specifies the content width of boxes.
It can have those values:
<length>
: Specifies the width of the content area using a length unit.<percentage>
: Specifies a percentage width. The percentage is calculated with respect to the width of the generated box's containing block.auto
: The width depends on the values of other properties.
You are using a percentage. Use a fixed length instead:
The format of a length value is a
<number>
(with or without a decimal point) immediately followed by a unit identifier (e.g., px, em, etc.).
You could target children of a parent no to scale by css selectors, but you cant disable scaling as a property on a single element unfortunately.
#parent > span:not(:last-child){
-moz-transform: scale(0.5);
-webkit-transform: scale(0.5);
-ms-transform: scale(0.5);
transform: scale(0.5);
display:block;
}
See this Answer