问题
i am using primeNG for angular
https://www.primefaces.org/primeng/#/flexgrid
when i am trying this
<div class="p-grid">
<div class="p-col-6">
<div class="box">6 </div>
</div>
<div class="p-col-6">
<div class="box">6 </div>
</div>
</div>
the boxs are on top of each other and not next to each other i run
npm install primeflex --save
and added
"node_modules/primeflex/primeflex.css"
to angular.json
seems to be some thing related to the primeflex.css
the p-col class is working fine but the p-col-# (p-col-1 , p-col-2 etc ) are not working as excpected
this is the values for the p-col
-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1;
-ms-flex-preferred-size: 0;
flex-basis: 0;
padding: 0.5em;
this is the values for the p-col-#
-webkit-box-flex: 0;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
padding: 0.5em;
if for exmample i change the padding of the p-col-# to 0 then it is working but i don't have padding.. (i tried to change the p-col-# to the same values as the p-col and it is not working )
any ideas ?
Thanks Rahav
回答1:
It is work in my Angular6 project.
install PrimeNG and PrimeFlex
npm install primeng --save npm install primeflex --save
add style to angular.json
"./node_modules/primeng/resources/primeng.css", "./node_modules/primeflex/primeflex.css"
app.component.html
<div class="p-grid">
<div class="p-col">1</div>
<div class="p-col">2</div>
<div class="p-col">3</div>
</div>
回答2:
I had the same problem in Angular 7 with PrimeNG PrimeFlex.
Added the following to the styles.css file to fix it.
* {
-webkit-box-sizing: border-box;
}
来源:https://stackoverflow.com/questions/52313827/flex-grid-not-working-for-p-col-primeng-angular-5