Using WordPress to Set Custom Images for Bootstrap Carousel

Upon reviewing the image I have linked https://i.sstatic.net/KhQ07.jpg, it is evident that there exists a gap between the displayed image and the navigation menu on the page. This layout was meticulously crafted by me in Wordpress, built entirely from scratch. All content relating to my Carousel feature can be found within this div.

    <div id="awesome-carousel" class="carousel slide" data-ride="carousel">

    </div>

My custom CSS is:

    .carousel { background: #000; }
    .carousel .item { height: 800px; overflow: hidden; }
    .carousel .item img { width: 100%; height: auto; margin-top: -0%; }
    .carousel-caption a { color: #fff; }

(1) How do I go about eliminating the troublesome gap? (2) Additionally, how can I ensure the complete image is contained within the designated area without any clipping at the bottom? The comprehensive code snippet inside page-home.php is as follows:

<?php get_header(); ?>
<div class = "container-fluid" style="overflow-y: auto">   
  <div class="row"> 
    <div id="awesome-carousel" class="carousel slide" data-ride="carousel">

          <!-- Wrapper for slides -->
          <div class="carousel-inner" role="listbox">

            <?php 

                $args_cat = array(
                    'include' => '18, 19, 22'
                );

                $categories = get_categories($args_cat);
                $count = 0;
                $bullets = '';
                foreach($categories as $category):

                    $args = array( 
                        'type' => 'post',
                        'posts_per_page' => 1,
                        'category__in' => $category->term_id,

                    );

                    $lastBlog = new WP_Query( $args ); 

                    if( $lastBlog->have_posts() ):

                        while( $lastBlog->have_posts() ): $lastBlog->the_post(); ?>

                            <div class="item <?php if($count == 0): echo 'active'; endif; ?>">
                               <?php the_post_thumbnail('full'); ?>
                               <div class="carousel-caption">
                                  <?php the_title( sprintf('<h1 class="entry-title"><a href="%s">', esc_url( get_permalink() ) ),'</a></h1>' ); ?>
                                                          <small><?php the_category(' '); ?></small>
                               </div>
                            </div>

                            <?php $bullets .= '<li data-target="#awesome-carousel" data-slide-to="'.$count.'" class="'; ?>
                            <?php if($count == 0): $bullets .='active'; endif; ?>

                            <?php  $bullets .= '"></li>'; ?>

                        <?php endwhile;

                    endif;

                    wp_reset_postdata();

                $count++;

                endforeach;

            ?>

            <!-- Indicators -->
              <ol class="carousel-indicators">
                <?php echo $bullets; ?>
              </ol>

          </div>

          <!-- Controls -->
          <a class="left carousel-control" href="#awesome-carousel" role="button" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
          </a>
          <a class="right carousel-control" href="#awesome-carousel" role="button" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
          </a>
    </div>
   </div >
   <!-- This is for Welcome Message -->
   <div class="row welcome">
    <h1>Welcome to MyanmarTourism</h1>
    <p>Wwer eree ere ae llji er we lkjj ewer jlkjkj erw jkljer lkjkje werewer wkerkjkl. We reakl lkjle aere ar akljiu are jearear lkljkjare. Jk are lkjklul kljrea elkjare lj. He ioierwer sdfsdf sdfeiuit kare adfkjkjl. Wer kjljser sejrlj ekrjkjsfiu ekrjlkejk.</p>
   </div>   

</div>   

<?php get_footer(); ?>

I greatly appreciate any assistance provided.

Answer №1

Seems like I found a solution, even though it might not be the clearest. But hey, it's effective!

.carousel_pos {
    position: relative;
    top: -20px;
}

After adding these properties to the code snippet below:

<div class = "container-fluid  carousel_pos" style="overflow-y: auto">  

</div>

The content shifted upwards and now comfortably touches the top menu. Success!

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

Is there a way to utilize solely Javascript in order to crop an image?

Is there a way to crop an image using plain JavaScript? I need a function that can take an image with specific width, height, offsetX, and offsetY and create a new image of the specified portion. I'm not very knowledgeable about HTML5 canvas and simi ...

How can I translate an entity diagram (.vpp) into a database or text file using Java?

Is there a way in Java to convert an entity diagram into a database table or text file? If so, how can this be accomplished? Is it possible to export the .vpp file to an HTML file and then convert the HTML file into a text file? Any help would be greatly ...

Leveraging Firebase in Electron Applications

I've been experimenting with integrating Firebase into Electron. However, I've run into a roadblock when trying to set it up similar to how I would on a regular web page. Since Electron pages are hosted locally and lack a hostname, the usual setu ...

The functionality of HTML5 Drag and Drop upload is currently disabled on versions of Internet Explorer 10 and below

I recently tried using the HTML5 DND file uploading feature from , but unfortunately, it does not seem to work on Internet Explorer versions below IE 10. Here are the error details encountered on IE browsers: User Agent: Mozilla/4.0 (compatible; MSIE 8.0 ...

Steps to make a unique custom tooltip without using jQuery by utilizing the title attribute

I am looking to implement a tooltip similar to the one shown in the image. The value in the title tag is dynamic and fetched from the controller. https://i.sstatic.net/C2v3D.png Below is the code snippet of my table: <table border="1" cellpadding="10" ...

Adaptive navigation bar featuring a drop-down menu and a branded logo placed strategically amidst sections

I'm having trouble making my navbar responsive. I want the links to collapse into a hamburger icon when the screen width is adjusted, displaying only the logo and hamburger icon with the links in portrait mode. The example at this link comes close to ...

Button clicking to zoom in and out with three.js

I am looking to include two buttons for zooming in and zooming out. How can I achieve this? I attempted to use the following code, but it did not work for me. var controls = new THREE.OrbitControls(camera, renderer.domElement); function zoomModel(isZoo ...

Utilize Various Guidelines for Clicking on Various Thumbnails (jquery)

I am new to the world of HTML/CSS and have been struggling with a jQuery challenge while building my first website. My goal is to create a jQuery-powered image gallery using thumbnails. I found a tutorial by Ivan Lazarevic () and also sought help from Stac ...

Tips for validating a form with the assistance of jQuery

While there are multiple answers out there for this particular question, I am specifically interested in validating an entire form with dynamic input fields sourced from a database similar to Google Forms. HTML <div class="rs_card"><spa ...

Accessing private posts on Wordpress for designated individuals

I'm feeling a little lost. By default, WordPress displays a 404 error when someone tries to access a private post. Is there a way for me to customize this behavior? I would like to show the post to a specific user: if ( show_post_to_the_user(get_curr ...

JQuery - Receive an error message when a value is missing

With my Website almost complete, I just need to add an error message for when a movie isn't found. I have an API that returns JSON and if someone enters an invalid movie like "ifeahaef," it returns null. Is there a way to use Jquery to display an erro ...

issue with the alteration of table row colors

I am facing an issue with my database and a table called status. In this table, a status of 0 signifies unread, while a status of 1 represents read. The goal is to have rows with a status of 0 appear lime green and rows with a status of 1 show up as white. ...

Pinpointing a specific region within an image by utilizing offsets

Would it be possible to detect a specific area within an image using a predefined set of image offsets? Here is the image and accompanying offsets: Sample Image Below are the sample image offsets for the highlighted area: Offset(63.4, 195.2) Offset(97.7 ...

Presenting data in various formats

I've got a JSON file with a list of data that includes months and years. I want to display all the months, but have the year only appear once in a big block area. Here's an image example: https://i.stack.imgur.com/Ps3OF.png The image demonstrates ...

Aligning text to the right in Bootstrap 5 input fields

I'm trying to align the values of my inputs to the right. Any suggestions on how to achieve this? Here's a visual representation of what I'm looking for. This is the snippet from my code: <td style="text-align:center; vertical-alig ...

Recreate etched effect in IE9 using CSS for text styling

Is there a way to achieve the look of engraved text with a text-shadow in IE9? In Chrome and Firefox, I have used the following CSS (http://jsfiddle.net/YbyzF/): text-shadow: 0px 2px 0px rgba(255,255,255,.3), 0px -2px 0px rgba(0,0,0,.3); Unfortunately, ...

Implementing the switchClass function on a parent class when hovering over a child class, while ensuring that only the specific divs are targeted and not others with the

Currently using the .switchClass function on both the .container divs whenever I hover, causing all child1 elements within these containers to change from 100% width to 40% width. However, I only want this switch to occur on the specific container that I&a ...

With jQuery's .text() method, it is possible to modify the first span's Bootstrap class, but not the

As someone who is new to javascript, html, and jquery, I have been trying to change the text of 2 span elements in the same div using jquery's .text() command. Despite going through various solutions provided by different questions, none seem to work ...

CSS responsive design: concealing elements does not prevent the page from being displayed

Imagine a scenario where I need to display a template in two different versions based on the user's device. For instance, I have utilized the following code: <div class="desktop"> <body> Hi Desktop user </body> </div> ...

PHP create hyperlink only if it has not been already linked

Could someone help me with a question that is similar to this one: How to Emulate StackOverflow Auto-Link Behavior Nevertheless, I am facing an issue with mixed content containing links. URLs that are already within A tags <a href="http://stackoverflo ...