Okay
  Public Ticket #3001444
Search Block
Closed

Comments

  • William Derichsweiler started the conversation

    I'm using the following CSS to align the Search Block with the table created and make it responsive and stay aligned with the table.

     

    @media only screen and (min-width: 500px) {.wpDataTablesWrapper .dataTables_filter label {
    margin-left: 307px!important;
    border: solid!important;
    border-width: 2px!important;
    padding: 5px!important;
    }

    input.form-control {
    border-bottom: none!important;
    }
    }

    But I seem to be missing something with the code to make it work properly on all devices. 

  •  1,851
    Miloš replied

    Hi, William

    Thanks for reaching out to us

    - These CSS styles, are called on a media query, that is stating this should happen only when the screen goes larger than 500PX ( min-width 500px)

    5754999794.png
    9622616921.png


    If we remove the media query only for width larger than 500PX, and now this is going to be applied on all screens :

    .wpDataTablesWrapper .dataTables_filter label {
    margin-left: 307px!important;
    border: solid!important;
    border-width: 2px!important;
    padding: 5px!important;
    }
    input.form-control {
    border-bottom: none!important;
    }
    

    Check it out, and let me know if you need further assistance. Thankssmile.png

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1,851
    Miloš replied

    Hi, William

    Sorry, just remembered something to add... In case that the alignment does not perfectly look on all screens... You can consider to actually leave the old Styles as they were.... So, you can keep this, for screens larger than 500PX ( one CSS statement for screens larger than 500PX width) :

    @media only screen and (min-width: 500px) {.wpDataTablesWrapper .dataTables_filter label {
    margin-left: 307px!important;
    border: solid!important;
    border-width: 2px!important;
    padding: 5px!important;
    }
    input.form-control {
    border-bottom: none!important;
    }
    }

    and you can add another one, to create different styles, for when the screens are below 500PX, like this :

    @media only screen and (max-width: 500px) {.wpDataTablesWrapper .dataTables_filter label {
    margin-left: 307px!important;
    border: solid!important;
    border-width: 2px!important;
    padding: 5px!important;
    }
    input.form-control {
    border-bottom: none!important;
    }
    }
    

    ( I just copied same styles, but you can edit them) 

    and then, see if, for screens smaller than the width of 500PX, if you need to make "different" adjustments", if that makes sense?smile.png

    Just an advice, because I had experienced when that had to be done. Of course, this depends on what design you are going for.

    Here is a useful resource about creating manual responsive breakpoints :

    https://www.w3schools.com/css/css_rwd_mediaqueries.asp

    ( P.S.

     I am a huge fan of the game - Smite, it's awesomesmile.png )

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • William Derichsweiler replied

    Hi Miloš!

    Thanks for the help with the snippet. One thing I forgot to mention is that I need the Search Block on the left-hand side. 

    I was doing this with the following snippet

    .wpDataTablesWrapper .dataTables_filter label {
    float: left!important;
    }

    But it looks like the snippets you shared moves the Search Block back to the right-hand side. Any thoughts?

  •  1,851
    Miloš replied

    Hi, William

    - I just basically copied the same snippet which you sent me in the original message?

    @media only screen and (min-width: 500px) {.wpDataTablesWrapper .dataTables_filter label {
    margin-left: 307px!important;
    border: solid!important;
    border-width: 2px!important;
    padding: 5px!important;
    }
    input.form-control {
    border-bottom: none!important;
    }
    }
    

    I did remove the media query statement from it, so, technically I did change it, because you wanted the snipped to be applied to all screen sizes, I guess.smile.png

    -

    Now, the margin-left property is pushing the element away from the left edge of the page ( moving it to the right).

    While 307 pixels might be OK on larger screens, if you decrease the screen, the width shrinks, and the element will seem as it is pushed more to the right.... Perhaps you can try to use percentage value instead of PX, that way it will always look to take certain percentage of the screen/page, rather then fixed pixel value - if that makes sense.

    So, basically, if you reduce this margin-left value, or completely remove it for smaller screens, maybe you can add a CSS media query for screens smaller than 500px width like this :

    @media only screen and (max-width: 500px) {.wpDataTablesWrapper .dataTables_filter label {
    float:left !important;
    border: solid!important;
    border-width: 2px!important;
    padding: 5px!important;
    }
    input.form-control {
    border-bottom: none!important;
    }
    }

    - Seems like you changed something in the meantime as well? Apologies for my slow response time.smile.png

    Let me know how it goes, and if I can assist further. Thank you

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables