flex grid not working for p-col-# primeng Angular 5

荒凉一梦 提交于 2019-12-10 17:29:33

问题


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.

  1. install PrimeNG and PrimeFlex

    npm install primeng --save
    npm install primeflex --save
    
  2. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!