What is the best way to insert a <dv> element following a <Typography> component in the provided code?

After learning React, I have attempted in various ways to get this code snippet to work. I referred to a question on Stackoverflow as well as the HTML div documentation

The goal is to have the text and link displayed in a horizontal line, not vertically stacked like shown in the image below:

https://i.sstatic.net/0plSo.png

If anyone could provide assistance or recommend further reading materials for mastering this concept, it would be greatly appreciated.

<Box alignItems="center" display="flex" ml={-1}>
    <Checkbox checked={values.policy} name="policy" onChange={handleChange} />
    <Typography color="textSecondary" variant="body1">
        I have read the
        <div role="article">
            <a target="_blank" rel="noreferrer" href="http://greta.portplays.com/Privacy%20Policy.html">
                Privacy Policy
            </a>
        </div>
    </Typography>
</Box>
<Box alignItems="center" display="flex" ml={-1}>
    <Checkbox checked={values.policy} name="Terms" onChange={handleChange} />
    <Typography color="textSecondary" variant="body1">
        I have read the
        <div role="article">
            <a target="_blank" rel="noreferrer" href="http://greta.portplays.com/Terms%20of%20Service.html">
                Terms and Conditions
            </a>
        </div>
    </Typography>
</Box>

Answer №1

Have you tested out this solution?

...
I recently reviewed the
    <span role="article">
        <a target="_blank" rel="noreferrer" href="http://greta.portplays.com/Terms%20of%20Service.html">
            Terms of Service
        </a>
    </span>

Additionally, considering that a is an inline element, it may not necessarily require the span. Further insights on inline and block elements in CSS can be explored for better understanding.

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

Every time I try to print out the response, I keep seeing "undefined"

export const fetchAllUsers = async() => { try { await axios.get(`${URL}/all`) } catch (error) { console.log("Error while calling getUsers API", error); } } const displayAllUsers = async () => { let userDat ...

website with a horizontal scroll-bar

Looking to create a horizontal scrolling website where the divs float to the right without specifying the container's width, as it may vary on different pages. Any suggestions? ...

Error encountered: Module 'redux-saga/effects' declaration file not found. The file '.../redux-saga-effects-npm-proxy.cjs.js' is implicitly typed as 'any'. Error code: TS7016

<path-to-project>/client/src/sagas/index.ts TypeScript error in <path-to-project>/client/src/sagas/index.ts(1,46): Could not find a declaration file for module 'redux-saga/effects'. '<path-to-project>/client/.yarn/cache/red ...

Issue arising from background change upon component focus

My component needs to change its background color when focused, but for some reason it's not working. The hover effect works fine, but the focus doesn't. Can anyone assist me with this issue? import { CardContainer } from './styles' in ...

Learn how to create a half and half color scheme in an HTML table

I have created an HTML table that resembles a calendar. Various events are registered in the calendar, each distinguished by its color. However, I am looking to change the colors of the cells to be half and half. https://i.sstatic.net/gaQq2.png The imag ...

It is necessary for ReactJS eslint rules to employ destructuring when assigning state

class MyDrawer extends Component { const modalOpen = this.state; // Initialize state in the constructor render() { return ( <div> <Drawer modal open={this.state.modalOpen} // <-- this line show error ...

Troubleshooting Problems with display:table and display:table-cell Alignment in Internet Explorer Versions 7 and 9

I have been struggling with the layout of a website that contains multiple columns. After extensive work, I believed I had everything properly aligned. Adobe BrowserLab seemed to confirm this, aside from various issues in IE6 and IE7 which I decided to ove ...

Error in Next.js: The element type is not valid. Please make sure it is either a string (for built-in components) or a class/function (for composite components) and not undefined

I've encountered an issue while working on my Next.js project where I am trying to import the Layout component into my _app.js file. The error message I received is as follows: Error: Element type is invalid: expected a string (for built-in componen ...

The presence of a Bootstrap addon is resulting in horizontal scrolling on mobile devices within the webpage

I am encountering a peculiar issue with an input-group in my cshtml file which features a Bootstrap addon. The problem arises on mobile devices, where upon focusing on the input field, the page scrolls horizontally to the right, revealing the right margin ...

Monitoring user activity in React application using Google Analytics

We currently have a React application that is integrated with Google Analytics. Within our React setup, we utilize a specific hook called 'usePageTracking.js' in our App.js file. usePageTracking.js import { useEffect, useState } from 'react ...

Is there a way to use JavaScript or jQuery to automatically convert HTML/CSS files into PDF documents?

While using OS X, I noticed that in Chrome I have the option to Save as PDF in the print window by setting the destination to "Save as PDF". Is this feature available on Windows? Is there a way to easily save to PDF with just one click? How can I access t ...

What is the best way to set up a session in a Next.js project?

I am currently utilizing Next js for my project development. I've successfully crafted a unique signup form within the platform where users can input their email and password, followed by an OTP being sent to their email address for verification purpo ...

Which CSS preprocessor is the best choice for WordPress: SASS or

After comparing SASS and LESS, I found that SASS is the clear winner in my opinion. Unfortunately, setting up SASS on my server requires ruby, gems, and other tools that I don't have access to. On the other hand, it seems like adding LESS to my proj ...

Are the Material UI API documentation in need of an update?

Do you think the Material UI API documentation may be outdated? Is there another resource where we can find information on element preferences? For example, MenuList https://material-ui.com/api/menu-list/ includes a property called disablePadding to remov ...

Struggling with incorporating a Carousel feature while navigating through an array

I am struggling to properly implement a carousel using the data from my Videos Array. Instead of getting the desired output where videos should slide one by one, all the videos in the Array are being rendered at the same time. <div id="carouselEx ...

Emmet code condensed into a single line

Currently, I am learning how to utilize Emmet with Visual Studio Code specifically for TypeScript React files *.tsx. For example, when I input div.buttons>button.something+button.something-else and press TAB, it expands as shown below: <div classNa ...

Achieve a fade-in effect on an element with TailwindCSS when clicked

Currently working on an app and facing a challenge with fading the menu in and out when clicking a button. The menu is rendering on click using state, but struggling to achieve the fade in / fade out effect. Interestingly, when tweaking the opacity value d ...

Challenges arise when utilizing CSS3 animations in conjunction with transitions triggered by toggling a JavaScript class

Struggling to activate an animation while updating a class using JavaScript for a PhoneGap app. Planning on utilizing -webkit- prefixes for compatibility. However, the animations are currently unresponsive in Chrome during testing, both when applied to th ...

Signs that indicate a React component is prepared for interaction

I'm interested in finding out how to measure TTI (web vital) for a React app. We specifically need measurements for individual components and not the entire page, so using Lighthouse is not suitable for our needs. ...

The Nginx container's memory consumption spikes after transmitting video metadata on the connected volume

I currently have an AWS server running docker containers. Within the server, there are numerous mp4 videos totaling a few hundred GB in size. Each video is approximately 30 MB. One of the services included is a React app that allows users to watch videos ...