Expanding scrollbar when hovered over

My goal for a landing page design is to showcase a centered logo at the top, followed by three images with borders arranged side by side, each with a bit of padding. When a user hovers over any of these images, I want the text on that image to slide to the bottom and be enclosed in a box. Additionally, I aim to have the page fill 100% of the browser window without any vertical scrolling on desktop, but on tablet or mobile devices, the images should stack neatly.

While I have managed to implement the text sliding effect and the stacking for smaller devices, I have encountered a few issues.

Despite my efforts, I have not been able to restrict the page to 100% of the browser window on the desktop. There always seems to be a slight vertical scrolling requirement to view the bottom of the three images.

Furthermore, upon hovering over an image, the scrollbar expands, indicating an issue with the hover code as it is pushing the entire overlay box downwards. I also aspire to enclose the text in a colored box upon hover, however, my attempts to add a background or border result in enclosing the entire overlay element rather than just the text. I am unsure of how to resize the text element to be centered within the image, matching the text size so it can be styled further.

Any help or guidance on these issues would be greatly appreciated. Thank you.

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
    <style>
        .overlay {
            position: absolute;
            top: 50%;
            bottom: 0;
            left: 0;
            right: 0;
            width: 100%;
            height: 0;
            transition: .5s ease;
        }
        .cols {
            position: relative;
            text-align: center;
        }
        .cols:hover .overlay {
            bottom: 0;
            height: 100%;
        }
        .cols img {
            border: 10px solid #332b2a;
            height: 100%;
            width: 100%;
        }
        p {
            color: white;
            font-size: 30px;
            font-family: 'Roboto', serif;
            font-weight: 800;
            position: absolute;
            top: 50%;
            left: 50%;
            -webkit-transform: translate(-50%, -50%);
            -ms-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
            text-align: center;
            white-space: nowrap;
        }
        .imageCentre {
            display: block;
            margin-left: auto;
            margin-right: auto;
            width: 20%;
            padding-top: 10px;
        }
        .logo {
            padding-bottom: 10px;
        }
        .col-xs-6 {
            padding-bottom: 10px;
        }
    </style>
</head>
<body>
    <div class="container-fluid">
        <div class="row logo">
            <img src="images/logo.png" class="imageCentre" alt="Logo"/>
        </div>
        <div class="row">
            <div class="col-xs-6 col-md-4 cols">
                <a href="http://url.com" accesskey="l">
                    <div class="overlay">
                        <p>TEXT 1</p>
                    </div>
                    <img src="images/image1.jpg" alt="Image 1" />
                </a>
            </div>
            <div class="col-xs-6 col-md-4 col-md-offset-2 cols">
                <a href="http://url.com" accesskey="c">   
                    <div class="overlay">
                        <p>TEXT 2</p>
                    </div>
                    <img src="images/image2.jpg" alt="Image 2" />
                </a>
            </div>
            <div class="col-xs-6 col-md-4 col-md-offset-2 cols">
                <a href="http://url.com" accesskey="o">
                    <div class="overlay">
                        <p>TEXT 3</p>
                    </div>
                    <img src="images/image3.jpg" alt="Image 3" />
                </a>
            </div>
      </div>
    </div>
</body>
</html>

Answer №1

If you're looking to make some CSS tweaks, you might want to consider incorporating the following snippet into your code:

html
   {
     font-size: 16px;
     color: #333;
   }

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

Nested navigation in Bootstrap

I am currently working on creating a multilevel menu using Twitter Bootstrap. Check out the code here Below is the snippet of HTML code: <!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> ...

Alteration in relational shift of division placement

My webpage is divided into three sections with the following proportions: 15% - 65% - 20% In the right section, there is a div with the ID alchemy. I want to set the height of this div using <div style="height:150px;">. However, when I set the heig ...

Attempting to hide anchor tags for "register" and "login" while making the anchor tag for "logout" visible after signing in

After signing in, I want the register and login anchor tags to disappear and the logout anchor tag to appear. However, the login and register links stay visible on the page even after I sign in. <div class="navbar-nav ms-auto"> <% ...

Troubleshooting HTML/CSS problem related to background size adjustment

Struggling with setting a background image on my HTML code. The issue is when I resize the browser, the image either zooms in too much or cuts off part of the website. Is there a way to resize the background image based on the browser window size? Appreci ...

Steps to design a text div that extends beyond the bottom boundaries

Can anyone help me troubleshoot this design code using Bootstrap 3.x? Specifically, I am facing an issue with the following div. Any suggestions? Click here for more information. img{max-width:100%;} .mydiv{margin-bottom:20px;} .mytext{ positio ...

Personalized Bootstrap grid rows and columns

https://i.sstatic.net/R0yFY.png As a beginner in Bootstrap, I am having trouble achieving this specific layout in Bootstrap 4 grid. The areas marked in red are not appearing as expected. Here is what I have attempted so far: <div class="row"> ...

Is there a method in JavaScript to prevent href="#" from causing a page refresh? This pertains to nyroModal

Is there a way to prevent <herf="#"> from causing a page refresh? I am currently working on improving an older .NET web project that utilizes nyroModal jQuery for displaying lightboxes. However, when I attempt to close the lightbox, nyroMo ...

What makes text-decoration a crucial element of the foreground design?

<span>Educating children on unlocking their creative and intellectual potential through the world of Computer Science.</span> Here is the HTML code provided above along with the corresponding CSS: span { text-decoration: underline; color: red ...

Creating visually pleasing HTML emails with uniform table data heights

Struggling with Outlook while designing an HTML template. My row has 2 td elements with different content, and setting equal heights is proving to be a challenge. The fixed height on the td causes issues when switching to mobile view in Outlook as text wra ...

Issues with navigation functionality in Internet Explorer 8 have been identified in Twitter Bootstrap 3 RC2

I am currently using Twitter Bootstrap 3 RC2 to create a navigation bar at the top of my page, which is working perfectly fine except on IE8. In IE8, it seems like the browser is rendering the page as if it were on a smaller screen, causing the menu to co ...

What are the steps to increase the size of the search bar?

I have been working on this code, but I am struggling to align the search bar properly within the navigation bar. Can someone please guide me on how to achieve this? I apologize for my lack of coding expertise, as I am new to Information Technology and s ...

Shuffle contents of a Div randomly

I'm currently in the process of developing a new website and I need to randomly move the news feed. To achieve this, I have created an array containing the list of news items. The array is then shuffled and placed within the news feed section. Althou ...

Header, footer, and sidebars are all locked in place, while the central content area is designed for

Using this Demo Template as a starting point, I am looking to create a new layout: However, I am encountering the following challenges: The two sidebars are not properly contained within the scrollable content div. The content div does not have a fixed ...

Steps for Implementing a "Load More" Button on an HTML JSON Page

I'm currently engaged in a project that involves fetching product information from a JSON file and displaying it on an HTML page using JavaScript. While I've successfully implemented the fetch function, I now want to add a "Load More" function/bu ...

Basic adaptable menu for easy navigation

I have designed a custom menu in HTML: <div class="trigger" style="display:none;">menu</div> <div class="nav"> <ul> <li><a href="#">Home</a></li> <li><a href="#">News</a& ...

A versatile function that displays a loading icon on top of a specified div

Is it possible to pass an identifier for a particular div element to a function, where the function will display a loading image that covers the entire div, and then pass the same identifier to another function to hide the loading image? I am looking to cr ...

What is the best method for creating a header design in CSS?

My website code is pretty standard <div class="header"></div> <div class="site-inner"></div> <div class="footer"></div> How can I achieve a header background like the one shown in the image? Do I need to set the entire ...

Tips for ensuring Marketo forms are responsive when integrated into a WordPress website

We are currently using Wordpress for our responsive website. Within the site, we have integrated Marketo forms (a marketing automation system) with custom CSS for styling. The issue we are facing is that while the forms appear fine on desktops, they cause ...

Navigating React Router: Updating the page on back button press

Looking for a solution to a persistent issue. Despite various attempts and exhaustive research, the problem remains unresolved. Here's the situation: Within my React-Router-Dom setup, there is a parent component featuring a logo that remains fixed an ...

Having trouble with updating your website asynchronously through code? In need of a detailed explanation?

Here are two Javascript functions that are used to call a python file in order to update an HTML page. The first function works perfectly fine, but the second one seems to be malfunctioning without throwing any errors. function button(key) { var xhttp ...