Get rid of the gap between two bootstrap columns

I recently started work on a blog-like React application and implemented the Bootstrap grid system. However, I have noticed a significant gap between my two columns. Is there a way to remove this extra spacing? Attached is a screenshot for reference.

        import React from 'react';
        import ReactDom from 'react-dom';
        import 'bootstrap/dist/css/bootstrap.css';
        import faker from 'faker';

        // Creating a new component

        const App = () => {
            const myCustomStyle = {color:'green', fontSize:'50px'};
            return (
                <div className="container">
                   <div className="row">
                        <div class="col-3">
                            <a href="/" className="avatar"><img alt="avatar" src={faker.image.avatar()}></img></a>
                        </div>
                        <div class="col-9" >
                            <p><b> Alex</b><span> Today at 5.00pm</span></p>
                            <p> Great blog post!</p>
                        </div>
                   </div>
                </div>
            )
        }

        ReactDom.render(<App />, document.querySelector('#root'))

https://i.sstatic.net/Ipmvi.png

Answer №1

To optimize your layout, consider using Bootstrap 4's auto-layout columns...

col-auto - allows flex shrink
col - enables flex grow

<div class="container">
   <div class="row">
        <div class="col-auto">
            <a href="/" class="avatar"><img alt="profile picture" src="//placehold.it/100" /></a>
        </div>
        <div class="col">
            <p><b>Samantha</b><span>Yesterday at 3:00pm</span></p>
            <p>Fantastic article!</p>
        </div>
   </div>
</div>

Check out this link for reference

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

I am currently exploring the world of HTML and CSS, but I am struggling to grasp the concept of how contact forms operate. Can anyone provide some

I'm new to learning HTML and CSS and I'm struggling to understand how contact forms function. Where does the email address get stored in this code? Do I need a PHP file for this to work? <section class="signup-section" id="signu ...

Having trouble loading static assets in next.js framework

I am currently using Next.JS to develop a small landing page that features videos and images. To house these static assets, I decided to create a static folder and call the videos/images from there. However, I have encountered an issue where Next is unabl ...

Creating UL tabs using just HTML and CSSHere's a step-by-step guide

Looking for help to accomplish this task. I already have the styling, but I want something to happen when I click on the tabs. Specifically, I want the div with the tab class names to show and hide upon clicking the tabs. Currently, nothing happens when I ...

Is it recommended to incorporate router.isReady when making requests with react-query?

Struggling with incorporating react-query into my codebase, currently using getStaticProps. Experimenting with router.isReady from next/router to ensure the page waits for router.query value before passing it as props to the react hook. Take a look at my ...

Endless Loops: "anticipating the outcome"

I am attempting to create a recursive loop in LESS 1.3.1 that involves manipulating colors. However, despite my efforts, the recursive loop fails for some reason. @iter: 4; .loop(@index, @n) when (@index <= @n) { // Why does it throw an "expected expr ...

Flexbox: changing the order and arranging columns in a vertical stack

At a specific screen size, I need to rearrange three columns on my website. Currently, the layout consists of two columns that are 1/4 width each with a 1/2 width column in between them. I want to change the two 1/4 width columns into 1/2 widths and stac ...

Using the HTML date picker on an Android device for manually inputting dates

The built-in date picker: <input type="date"> on my Android device (Google Pixel 4a running Android 11) does not give me the option to manually enter the date. Each time I try to input a date, the date picker appears instead of the keyboard. Is ...

What is the best way to partition JSON data from an API request in React and display it in various sections within the component

There are 2 JSON objects that contain sales period details based on Month to date and year to date. The data includes information such as Units Sold, Gross Revenue, Year to Date Totals, Month to Date Averages, Expenses, Net Revenues, and Per Unit values. I ...

Creating a unique CSS layout with intricate border designs

Looking to create a text container with an unconventional border style like in this image: https://i.sstatic.net/qo9CL.png The irregular borders are throwing me off, especially considering the text inside and the need for responsive design. Any suggestion ...

Adjusting the width of a Material UI drawer: Tips and tricks

Currently, I am working on implementing the Material UI drawer and anchoring it to the top of my page. It is functioning correctly, however, I am encountering an issue where I am unable to adjust the width of the drawer. Despite trying to update the width ...

How come there is a varying gap between the fixed header and the main content when the height is set to 10%?

I've noticed a peculiar issue when using percentage values for the height of my fixed header and margin-top of the main div. Everything works smoothly when I set the header height to 50px and margin-top of the main area to 50px. However, when I chan ...

Stylish HTML button featuring a trio of horizontal dots

https://i.sstatic.net/cywxH.png I am attempting to design a button featuring three horizontal dots, similar to the image provided in the screenshot below. I am using the CSS class and Unicode Character "…" (U+2026). However, when I add a background, the ...

Problems arising from the usage of setInterval within the useEffect hook

I have encountered an issue while trying to use setInterval within useEffect. To ensure functionality, I moved the logic to a separate function and it works perfectly; alternating between two images every 3 seconds as intended. const rotateImages = (img) ...

"Enhance your data input experience with ReactJS by utilizing various components for

I'm facing a challenge with inserting data into a database using multiple components in reactjs. In my initial component, I've created a Form without a submit button as shown below: render() { return ( <form> <input type="te ...

Leveraging the power of jQuery and vanilla JavaScript to create a pop-up print window for a Div element within a CMS platform that does not support media query stylesheets

I have been grappling with this particular issue for weeks now, seeking guidance from previous inquiries here. Yet, despite the helpful hints, I am still struggling to find a viable solution. My website features a scrolling sidebar measuring approximately ...

How can we efficiently generate ReactJS Router for Links and seamlessly display a unique page for each Link?

Currently, I have an array of objects named titleUrl, which contains titles and URLs retrieved from an API. To display these as links on the sidebar, I am utilizing a custom component called MenuLink. The links are generated by iterating over the keys in t ...

Calculate the difference and sum of time values with varying signs in JavaScript

-12:00 - 5:30 => -6:30 -2:00 - 5:30 => 3:30 00:00 - 5:30 => -5:30 6:00 - 2:30 => 3:30 I am interested in subtracting time with both positive and negative indices. let myCountries = [ { countryName: "NewZealand", ...

What methods can be used to alter the appearance of a disabled and checked checkbox?

Is there a way to change the appearance of my enabled and disabled checkboxes to be green? I've tried adjusting various CSS properties but so far have only been able to change the outline color. Any tips on how to make the checkbox itself appear green ...

Is it possible to have CSS handle only horizontal overflow?

Can CSS 2.1 be used to achieve horizontal overflow only? overflow: auto; If this code will result in both vertical and horizontal scrollbars for a block element, is there a way to display only horizontal scrollbars (for example, within a <div>)? Ho ...

Advantages of Maintaining or Disabling the CSS Outline on Websites

Have you noticed how anchors around buttons or images create a dotted outline when clicked on or in focus? I usually disable these outlines with CSS to give a cleaner look, but I've heard there can be issues for keyboard-based users. What has been you ...