Adding text after a div in React-JS using Bootstrap: A quick guide

Just starting out with website development and I have a question. As I practice making this website, I am struggling to figure out how to add the text "To know more about us click here" below the 'Get started' button. I tried adding a simple <a> tag after the buttons div but it doesn't seem to work. Here is what I want the final result to look like: https://i.sstatic.net/TqAD9.png

If it helps, here is the entire website hosted on Netlify:

Here's the code:

import React from "react";
import web from "../src/images/myimage.svg";
import {NavLink} from "react-router-dom";
import Common from './Common';
import CarouselContainer from "./CarouselContainer";
import Aboutrefer from "./aboutrefer";

const Home = () => {
    return (
         <>
         <CarouselContainer/>
        
         <Common name ='Learn with' imgsrc={web} visit='/service' btnname='Get started' />
        
       </>
    );
};

export default Home;

Code of Common.js:

import React from "react";
import web from "../src/images/myimage.svg";
import {NavLink} from "react-router-dom";

const Common = (props) => {
    return (
         <>

          <section id= "header" className= "d-flex align-items-between ">
          <div className= "container-fluid">
            <div className='row'>
                <div className= "col-12 mx-auto">
               
                  <div className ="row">  
                  
                  <div className= "col-md-6 pt-5 pt-lg-0 order-2 order-lg-1 d-flex justify-content-center flex-column">
                    <h1>{props.name} <strong className= "brand-name"> Pinnacle Tutorials</strong>
                    </h1>
                    <h2 className= "my-3">
                       We are a team of talented Teachers here for your ward
                     </h2>
                     <div ClassName= "mt-3">
                         <NavLink to={props.visit} className= "btn btn-success">Get Started {props.btname}</NavLink>
                     </div>

                  </div>
                  <div className= "col-lg-6   order-6 order-lg-5  header-img  d-flex justify-content-end">
                    <img src ={props.imgsrc} className= "img animated" alt= "home img "/>

                  </div>
                 
                    
                  </div>
                </div>
               </div>
              </div>  
          </section>
         
    );
};

export default Common;

Answer №1

If you have a div with the "row" class, consider adding another div with the same class below it. In Bootstrap, using the "row" class will cause blocks to stack on top of each other and occupy the full width of the container.

Common.js:

<div className="row">
    ....
    <h2 className = "my-3">
        We are a team of talented Teachers here for your ward
    </h2>
    ....
</div>
<div className="row">
     To know more about us click here
</div>

Answer №2

If you want to add some additional content after the NavLink in Common.js, simply follow this example:

Here is an illustration:

<h2 className = "my-3">
  We have a dedicated team of skilled Teachers available for your child
</h2>
<div ClassName = "mt-3">
  <NavLink to={props.visit} className = "btn btn-success">Get Started {props.btname</NavLink>
</div>

Click here to learn more about us <NavLink to="/about">About</NavLink>

Complete code snippet:

import React from "react";
import web from "../src/images/myimage.svg";
import {NavLink} from "react-router-dom";

const Common =(props)  => {
    return (
         <>

         
          <section id = "header" className = "d-flex align-items-between  ">
          <div className = "container-fluid">
            <div className = 'row'>
                <div className = "col-12" mx-auto>
               
                  <div className ="row">  
                  

                  
                  <div className = "col-md-6 pt-5 pt-lg-0 order-2 order-lg-1 d-flex justify-content-center flex-column">
                    <h1>{props.name} <strong className = "brand-name"> Pinnacle Tutorials</strong>
                    </h1>
                    <h2 className = "my-3">
                       We are a team of talented Teachers here for your ward
                     </h2>
                     <div ClassName = "mt-3">
                         <NavLink to={props.visit} className = "btn btn-success">Get Started {props.btname}</NavLink>
                     </div>

Click here to know more about us <NavLink to="/about">About</NavLink>
                    
                  </div>
                  <div className = "col-lg-6   order-6 order-lg-5  header-img  d-flex justify-content-end">
                    <img src ={props.imgsrc} className = "img animated" alt = "home img "/>

                  </div>
                  
                    
                  </div>
                </div>
               </div>
              </div>  
          </section>
         </>

     
    );
};

export default Common;

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

What is causing some Font Awesome icons to not function properly with boostrapCDN?

I thought all Font Awesome icons would work by linking this bootstrap stylesheet, but I've only managed to get one of them (`.fa fa-deskto`) to display. The rest, like the second one for example (link below), simply don't show up: Both icons are ...

Preventing background style from taking precedence over backgroundColor style in React's inline styling

What causes background to take precedence over backgroundColor in React inline-style? In this scenario, the lack of a specified green background-color results in the background gradient with transparency transitioning into white rather than green within t ...

The issue of resolving NestJs ParseEnumPipe

I'm currently using the NestJs framework (which I absolutely adore) and I need to validate incoming data against an Enum in Typscript. Here's what I have: enum ProductAction { PURCHASE = 'PURCHASE', } @Patch('products/:uuid&apos ...

What steps can I take to replicate a 'heap limit Allocation failed' error?

Context I encountered a challenging issue where my program displayed a FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory This occurred when the memory usage reached around 512 mb Scavenge (reduce) 507.8 (518.9) -> 507.2 ...

Refresh a React component after modifying state in useEffect

I am working on a React component where I need to update a state in Mobx and then reload the same component when the state is updated. The component deals with a list of agencies, and I need to filter data from a database based on query parameters within t ...

Step-by-step guide on incorporating an additional element into the Yii radioButtonList layout

I am trying to display a radioButtonList with tooltips after each element. Here is the code I am using: <?php echo $form->radioButtonList($model, 'Field', CHtml::listData(FieldDataModel::model()->findAll(), 'id', 'name&a ...

Requesting an API token through the body using Javascript's Fetch function

I'm currently working on developing a frontend application using Javascript Fetch to interact with an API service. One of the tasks I need to accomplish is to create a token by using the POST method and sending an apiKey parameter in the Body. Once I ...

Vue Checkboxes - Maintain selection unless a different checkbox is selected

I have implemented a checkbox system with radio button behavior, but I am facing an issue where I want to keep the checkbox checked until another checkbox is selected (which will then uncheck the first one). I do not want the ability to deselect the checkb ...

Header with a dropdown select option

In the process of developing a monitoring system, I am in need of a feature that allows users to select varying numbers of days. Here is the desired style: Previous [Dropdown Selection] Days https://i.sstatic.net/ysk6X.png Ideally, I do not want any bor ...

Incorporate a JavaScript message using C# code in the backend

I am looking for a code snippet to execute a JavaScript function called recordInserted() that displays an alert, within the add_Click method in my code-behind file. Here is the relevant section of my code: protected void add_Click(object sender, EventArgs ...

Click on a div to smoothly scroll to the top, then automatically scroll to the bottom if already at the top position

I've implemented a JQuery code on my website that allows the page to scroll to the top when clicking on a div with the class of .bottom. The code is working perfectly fine, here it is: function scrollToTop(){ $('.bottom').click(function ...

Steps to create a React Native application for testing purposes without relying on local dependencies

I am new to developing react-native apps and I have a question about sharing developed apps with other developers without local dependencies. Do we need an Apple developer account for a test build to be shared on iOS? How can this test build be created so ...

Optimal method for transforming the values of an object or array in JavaScript

I have a group of values that need to be transformed into new values using a legend. The process might sound confusing at first, but it will become clear shortly. To achieve this, I've relied on associative arrays or objects in JavaScript to serve as ...

ASP: The submenu items remain visible

I must express my gratitude for the wealth of knowledge this site has provided me with. It has been an invaluable resource for me this year, even though I have scoured every corner and still come up empty-handed. Allow me to simplify the situation at hand ...

The JQuery video player's full screen toggle feature is not correctly assigning the class name

I've been tackling a bug in my JavaScript/jQuery video player that has left me stumped. One of the key features of this player is an enter/exit full-screen button located at the bottom of the HTML snippet: (function($) { /* Helper functions */ ...

Ways to eliminate the border color from bootstrap multiselect

I have been attempting to eliminate the border color surrounding options in a select box from Bootstrap Multiselect. Unfortunately, I am unable to identify the specific class responsible for adding the blue color around the option borders. This border app ...

Combine the entities within the object

I need to combine two objects that contain other objects within them, similar to the following structure: let selections = { 123: { abc: {name: 'abc'}, def: {name: 'def'} }, 456: { ghi: {name: ' ...

I am looking to modify the highlighted table cell whenever the value within it changes

I am currently working on a small project related to the Stock Market. In this project, I need to dynamically change the style of the td element based on data fluctuations - green highlight for an increase and red highlight for a decrease. In the provid ...

The Firefox browser is not fully displaying the button background

Having an issue with a button that doesn't completely fill up on Firefox only. Here's the problem in action: This is how it should actually look: Not quite sure what to do. Here's the CSS styling being used: .button-panel .button { -web ...

What is the best way to make a linear gradient that spans the entire vertical space that is visible (or shifts to a solid color)?

I'm trying to figure out how to apply a linear gradient to the body element of my webpage. Here's the CSS code I've been using: body { background: linear-gradient(0deg, white, lightgray); } The issue I'm facing is that the gradien ...