Flex网格不适用于p-col-#primeng Angular 5 [英] flex grid not working for p-col-# primeng Angular 5
问题描述
我正在使用primeNG进行角度
i am using primeNG for angular
https://www.primefaces.org/primeng/#/flexgrid
当我尝试
<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
并添加了
"node_modules/primeflex/primeflex.css"
到angular.json
to angular.json
似乎与primeflex.css有关
seems to be some thing related to the primeflex.css
p-col类工作正常,但p-col-#(p-col-1,p-col-2等)无法正常工作
the p-col class is working fine but the p-col-# (p-col-1 , p-col-2 etc ) are not working as excpected
这是p-col的值
-webkit-box-flex: 1;
-ms-flex-positive: 1;
flex-grow: 1;
-ms-flex-preferred-size: 0;
flex-basis: 0;
padding: 0.5em;
这是p-col-#的值
this is the values for the p-col-#
-webkit-box-flex: 0;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
padding: 0.5em;
如果例如我将p-col-#的填充更改为0,则它可以正常工作,但是我没有填充. (我试图将p-col-#更改为与p-col相同的值,但它不起作用)
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 )
有什么想法吗?
谢谢 拉哈夫
推荐答案
在我的Angular6项目中可以使用.
It is work in my Angular6 project.
-
安装PrimeNG和PrimeFlex
install PrimeNG and PrimeFlex
npm install primeng --save
npm install primeflex --save
向angular.json添加样式
add style to angular.json
"./node_modules/primeng/resources/primeng.css",
"./node_modules/primeflex/primeflex.css"
app.component.html
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>
这篇关于Flex网格不适用于p-col-#primeng Angular 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!