简体   繁体   English

如何编辑<rich:fileUpload> CSS?

[英]How edit <rich:fileUpload> CSS?

I'm trying to show only the button add and the uploaded picture below the button, but it doesn't matter what I do in my CSS, the table generated by richfaces is always the same: 我试图只显示按钮add和按钮下方的上传图片,但无论我在CSS中做什么, richfaces生成的表始终是相同的:

This is my form using richfaces : 这是我使用richfaces表单:

<ui:define name="content">
        <h:form>
            <h:panelGrid>
                <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}" id="upload" acceptedTypes="jpg, gif, png, bmp"  ontyperejected="alert('Just JPG, GIF, PNG and BMP are allowed');" maxFilesQuantity="12" immediateUpload="true" >
                    <a4j:ajax event="uploadcomplete" execute="@none" render="info" />
                </rich:fileUpload>

                <h:panelGroup id="info">
                    <h:outputText value="Add picture" rendered="#{fileUploadBean.size==0}" />
                    <rich:dataGrid columns="4" value="#{fileUploadBean.files}" var="file" rowKeyVar="row">
                        <a4j:mediaOutput element="img" mimeType="image/jpeg" createContent="#{fileUploadBean.paint}" value="#{row}" style="width:100px; height:100px;" cacheable="false" />
                    </rich:dataGrid>

                    <br />
                    <a4j:commandButton action="#{fileUploadBean.clearUploadData}" render="info, upload" value="Clear Uploaded Data" rendered="#{fileUploadBean.size>0}" />
                </h:panelGroup>
            </h:panelGrid>
        </h:form>
    </ui:define>

And this is how is generated : 这是如何生成的:

形成

I want something more simple 'cause in another moment I will some jQuery slider plugin. 我想要更简单的东西'因为在另一个时刻我将使用一些jQuery slider插件。 But I can't disappear with this table generated by richfaces . 但我不能用richfaces生成的这个表消失。 And yes skins are disable in my richfaces configuration : 是的,我的richfaces配置禁用了皮肤:

update Following the suggestion my CSS look like this now: 更新根据建议我的CSS现在看起来像这样:

    <style>
    div div.rf-fu { border: 0px; width: 85px; }
    div div.rf-fu-hdr { border: 0px; }
    span span.rf-fu-btn-clr { border: 0px; }
    span.rf-fu-btns-lft{ width: 85px; }
    span.rf-fu-btns-rgh{ display: none; }
    div div.rf-fu-lst { display:none; }
    </style>

And now my add.. file button looks like: 现在我的add..文件按钮看起来像:

在此输入图像描述

These post was very useful too: 这些帖子也很有用:

Should I use 'border: none' or 'border: 0'? 我应该使用'border:none'还是'border:0'?
Inner div has borders - how to override with a class on an outer div? 内部div有边框 - 如何覆盖外部div上的类?

You can use Adrian's answer to override richfaces css however you don't need to use !important to override richfaces css. 您可以使用Adrian的答案来覆盖richfaces css,但是您不需要使用!important来覆盖richfaces css。 Just use selector specificity to override the css applied by richfaces. 只需使用选择器特异性来覆盖richfaces应用的css。

For Instance in case where you are using important , apply the css as: 对于使用important实例,请将css应用为:

div div.rf-fu-lst { display:none } and it will work for you. div div.rf-fu-lst { display:none }它会对你div div.rf-fu-lst { display:none }

I'm currently doing this for my project. 我正在为我的项目做这个。 You have to override the richfaces css in your stylesheet like this: 你必须覆盖样式表中的richfaces css,如下所示:

.rf-fu, .rf-fu-hdr {
    float: left;
    width: auto;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
}

.rf-fu-btn-cnt-add {
    paddin-left: 0;
    cursor: pointer;
}

.rf-fu-btn-add {
    margin: 0;
}

.rf-fu-btns-rgh, .rf-fu-lst {
    display: none;
}

.rf-fu-btns-lft {
    width: 100%;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM