Using the flexslider to override CSS styles in an <li> element

I have implemented the flexslider by whoothemes on my responsive website to showcase tiles.

However, I am facing an issue with setting a specific width for the tiles on various devices. Upon inspecting with Chrome, I see this code:

<li style="width: 216.6px; float: left; display: block;">

While I can use the !important code to override it, this causes problems on Apple devices.

<ul class="slides">
                        <?php
                            $args = array( 
                                'posts_per_page' => -1, 
                                'post_type'=> 'cinema', 
                                'orderby'=> 'title',
                                'order'=> 'ASC',
                                'include' => get_option( 'sticky_posts' )
                            );
                            $args2 = array( 
                                'posts_per_page' => -1, 
                                'post_type'=> 'cinema', 
                                'orderby'=> 'title',
                                'order'=> 'ASC',
                                'exclude' => get_option( 'sticky_posts' )
                            );
                            $mypost_1 = get_posts( $args );
                            $mypost_2 = get_posts( $args2 );
                            $myposts = array_merge($mypost_1 , $mypost_2);

                            $start = '<li><ul>';
                            $end = '</ul></li>';
                            foreach ( $myposts as $key=>$post ) : setup_postdata( $post );
                                if( $key != 0 && $key % 3 == 0 ) echo $end;
                                if( $key == 0 || $key % 3 == 0 ) echo $start;
                        ?>
            <li>
                                <a href="<?php echo get_post_meta($post->ID,'link',true) ?>">
                                    <img alt="" src="<?php echo wp_get_attachment_url(get_post_thumbnail_id($post->ID)); ?>" />
                                </a>
                            </li>   
                         <?php
                            endforeach; wp_reset_postdata();
                            if( $key == 0 || $key % 3 == 0 ) echo $end;
                         ?>
                    </ul>

In order to address this issue, I have tried: - Adding a class to li in the provided code - Utilizing jQuery to remove the width from the style attribute (though it's not consistent)

If anyone can advise on how to effectively override the width set in the style element, I would greatly appreciate it. As a novice in this field, feel free to ask for more information if needed.

Answer №1

To change the width of the <li> element using CSS, include a max-width property in your style sheet.

Here's an example that relates to the link you shared:

.flexslider .slides > li {
    max-width: 100px;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Exploring the magic of Jquery Ajax with ASP MVC 3 Forms

I am currently developing a straightforward web application that requires updating form changes through Ajax requests. Although I have some experience with Ajax calls in MVC1 using MicrosoftAjax, I haven't touched it since. Now I have learned that Mi ...

Ways to terminate a script during a submit() event using jQuery

I have a simple form validation script that triggers a JavaScript alert() if any field value is less than 3 characters. However, after the alert, the page scrolls to the top instead of just stopping. Why is this happening? $('submit_button').sub ...

I'm using Bootstrap (version 5.3) and when I tried to replicate the features from the examples, I noticed that the background isn't being copied over

I encountered an issue today while working on a website using bootstrap. I was copying features from examples in the bootstrap section, but when I pasted the code into my coding platform, the background appeared transparent and did not display as expected. ...

Utilizing Jquery Ajax to send a post request containing input values through Tampermonkey

I encountered an issue with my code - even though the logs in console show that it is working, I am unable to send the values to my server using AJAX post. jQ(document).on("keyup", "form input", function () { var value = jQ(this).val(); ...

The arrangement of CSS code is crucial for it to work properly; any deviation from the correct order

I am facing a problem where I am trying to display a circular div using CSS, but it only works if the background image property is set first. Typically, this wouldn't be an issue if the image wasn't being dynamically inserted using PHP code. I ...

Eliminate certain inline styles using jQuery

I am facing an issue with an asp menu I am using. It is automatically inserting style="width:3px;" into my menu table tds, creating an unsightly gap between my tabs. Instead of asking our developer to customize the menu just to fix this cosmetic flaw, I am ...

I'm utilizing bootstrap to design a slider, but the length of the second div inside it is longer than the slider div

To ensure that the second div appears above the slide div, I applied position:absolute to the second div. Since the first div is a slider, nesting the second div inside it was not feasible. How can this issue be resolved? <div class="carousel slide"> ...

Despite the fact that wp_mail is returning true, emails are not being received

Despite wp_mail() returning true, I am not receiving any emails that are submitted through the contact form on my WordPress blog. I even attempted to change the email address from Gmail to Hotmail with no success. Ajax code in the contact template $(&apo ...

The functionality of Ajax calls is malfunctioning specifically in Internet Explorer

I followed the cart/jquery ajax tutorial found on this codeigniter cart and jquery tutorial at nettuts+ The implementation works perfectly in all browsers except for IE. I suspect it might be related to a css selector that earlier versions of IE do not su ...

Mastering Jquery Isotope integration with Wordpress for seamless filtering

I've been struggling to implement isotope filtering in my project. As a beginner in jQuery/javascript, I wanted to integrate isotope functionality into a client's website. Despite researching extensively on Stack Overflow and various websites, I ...

How to create a slideToggle effect for nested ul and li elements

Initially, everything was working fine until I put it through the W3C validator. After fixing the errors, now it's not functioning as expected. I have created a jsfiddle The setup involves nested ul elements being used as dropdowns, with headers tha ...

Tips for verifying the contents of a textbox with the help of a Bootstrap

I am still learning javascript and I want to make a banner appear if the textbox is empty, but it's not working. How can I use bootstrap banners to create an alert? <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&g ...

Creating an addition button using jQuery on-the-fly

Looking to implement pagination using jQuery and Ajax. The first hurdle I've come across is figuring out how to add a button dynamically. <div class="btn-group" id="pagination_group"> <button class="btn" disabled="disabled">First</ ...

Ways to display a specific section on an HTML page using AngularJS

Main page content <div class="row"> <div class="col-md-3"> link 1 link 2 link 3 . . . </div> </div> <div class="col-md-9"> <div ng-view></div> </div& ...

Is there a way to utilize the function body onload in jQuery?

I have some code that needs to be fixed. Currently, when I see <body onload="start()" onresize="resize()" onorientationchange="resize()">, I want the following code snippet to work: $("button").click(function(){ $("body").onload = start; or win ...

"Exploring the power of JQuery in adding new elements and accessing the newly appended

I have a code that appends some HTML to a div using JQuery like this: $("#divId").append("<div class='click' data-id='id'></div>"); and I want to access the appended div by clicking on it like so: $(".click").click(functi ...

Utilize Bootstrap 3 Datepicker version 4 to easily set the date using Moment.js or Date objects

I'm currently utilizing the Within my project, I have a datetime picker labeled as dtpFrom <div class='input-group date ' id='dtpFrom'> <input type='text' class="form-control" /> <span c ...

Move the cursor to the bottom of a div that can be edited

I have been struggling to position the cursor at the end of the next or previous editable content tag if the current one is empty. However, when I try to set focus, it always ends up at the beginning of the text instead of the end. I've tried various ...

Customize the appearance of the bootstrap nav-bar by assigning unique background colors to each dropdown menu

I'm looking to set unique background colors for each dropdown in a Bootstrap nav-bar using CSS. .mynavbar .dropdown ul.dropdown-menu:nth-child(1) { background-color: #59b057; } .mynavbar .dropdown ul.dropdown-menu:nth-child(2) { background-col ...

Change the input field font style in AngularJS

Check out this Plunker link for validation of input field: http://plnkr.co/edit/iFnjcq?p=preview The validation only allows numbers to be entered and automatically adds commas. My query is, if a negative number is entered in the field, how can I change th ...