What are the steps in creating a responsive UI with CSS?

How can I create a responsive UI using css for the following code snippet?

<Text className="w-100 mt-0 align-self-center">
    Lorem ipsum  Lorem ipsum  Lorem ipsum<span>{'$200'}</span>
</Text>

<Text className="w-100 mt-0 align-self-center">
    Lorem ipsum<span>{'$100'}</span>Lorem ipsum
</Text>

<Text className="w-100 mt-0 align-self-center">
    {"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s"}
    <Button
        className="link-button"
        variant={VARIANTS.LINK}
    >
        <ButtonText>{'here'}</ButtonText>
    </Button>
</Text>

The styles for Text and Button are as follows:

const Text = styled.div`
    font-family: ${(props) => props.theme.font.base};
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 24px;
    color: ${(props) => props.theme.colors.text.secondary};
    a,
    button {
        text-decoration: underline currentColor;
        &:hover:not(:disabled) {
            text-decoration-color: transparent;
        }
    }
    span {
        font-weight: 600;
        white-space: nowrap;
        @media screen and (max-width: ${breakpoints.desktop}px) and (min-width: ${breakpoints.laptopL}px) {
            margin-top: 25px !important;
        }
        @media screen and (max-width: ${breakpoints.tablet}px) {
            margin-top: 25px !important;
        }
    }
`; 

I am currently facing issues with the responsive view of this UI. How can I adjust the styles to make it work smoothly on all devices? Any assistance would be greatly appreciated.

https://i.sstatic.net/4w7GC.png

Answer №1

Bootstrap is a fantastic tool for creating responsive user interfaces.

Remember: You have the option to utilize bootstrap classes directly within your HTML file as well.

.align {
  color: #958989;
  font-size: 15px;
  font-weight: 500;
}

.responsive {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
}

span,
a {
  width: 10em;
}
<div class="align">
  <div class="w-100 mt-1 responsive">
    <span>Lorem ipsum</span>
    <span>Lorem ipsum</span>
    <span>Lorem ipsum</span>
    <span>$ 200</span>
  </div>

  <div class="w-100 mt-1 responsive">
    <span>Lorem ipsum</span>
    <span>$ 100</span>
    <span>Lorem ipsum</span>
    <span></span>
  </div>

  <div class="w-100 mt-1 responsive">
    <span> Ipsum has been the industry's standard dummy text ever since the 1500s</span>
    <a class="link-button"> here </a>
    <span></span>
    <span></span>
  </div>
</div>

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

Full-width header with scrollable content within the viewport

Is there a way to make the header and footer expand to 100% width while keeping the middle content width variable? You can view the source at http://jsfiddle.net/9dWcZ/ HTML: <div class="header"> this is header </div> <div class="content ...

ES6 does not work with React hello world

Can anyone help me with troubleshooting my code? I've checked the console on jsbin and can't find any errors. http://jsbin.com/susumidode/edit?js,console,output Class secondComponenent extends React.Component { render(){ return ( &l ...

Issue encountered during file transfer from React to Flask

I'm encountering an issue while trying to upload a file using React and sending it to the Flask backend via a post request. The error message I keep getting is Failed to load resource: the server responded with a status of 400 (BAD REQUEST). I've ...

Issue within the application causing a sudden shutdown

I have been encountering an application error in my android phonegap app. The issue arises when I transition from one page to another page, resulting in the following message: "A network error occurred.(file:///android_asset/www/home/home.html?userid=91 ...

Concealing columns in DataTables based on designated screen sizes

Issue I am facing a challenge with two DataTables — one with five columns and the other with four columns. My goal is to find a solution for hiding certain columns based on specific screen widths. Approaches I've Tested While resizing the browser ...

Tips for customizing the appearance of a highlighted row in MUI5

I'm still learning the ropes with MaterialUI and have recently started using V5. While I've come across code samples for this in v4, I'm a bit unsure on how to achieve the same result in mui5. Specifically, I have a data grid where I would l ...

Tips for incorporating material-ui icons into the column component of a data-grid component

I am currently working with the material-ui data-grid and I would like to display Edit icons from material-ui next to each row. Unfortunately, the data-grid does not provide any props specifically for this purpose. Below is the code snippet: import React ...

Unlocking the Possibilities of scroll-snap-type

My goal is to effectively utilize the scroll-snap-type property I'm struggling to understand why this code functions as intended html, body { scroll-snap-type: y mandatory; } .child { scroll-snap-align: start none; border: 3px dashed blac ...

What is the most effective method for transferring data to a concealed input field?

I currently have a webpage with dual forms - one on the main page and another within a Bootstrap modal. The primary form includes fields like "Neck, Chest, Waist," while the modal's form only has an email field. To streamline the submission process, ...

Attempting to preserve the CSS transform effect as I switch between menu options

Whenever I stop hovering over my element, it reverts back to its original position. However, I want it to remain in place when I am navigating through the "sousmenu" menu and only return to its original position when I am not hovering over the "sousmenu". ...

The height of the iframe with the id 'iframe' is not functioning as expected

I am trying to set the iFrame's height to 80% and have an advertisement take up the remaining 20%. Code <!DOCTYPE html> <html lang="en"> <head> </head> <body> <iframe id="iframe" src="xxxxxx" style="border: ...

Having trouble aligning a div vertically inside another div?

I am struggling to vertically align a div within another div. I have experimented with vertical-align, position: relative; top: 50%, and margin: auto; without success. Take a look at the code below: .main { font-family: "adobe-garamond-pro"; pad ...

When using deleteMany in change streams, only one deleted value is returned

I am struggling with filtering the returned values from a deleteMany request in my context using PusherJS. The problem is that it only returns 1 value deleted. Below is the change stream and Pusher code on the server side; if (schedules.operationType === ...

How to design a custom <md-switch> with an icon in Angular Material

Is it possible to incorporate an icon into the md-switch component? I drew inspiration from a demonstration on www.inbox.google.com https://i.sstatic.net/qjw40.png Appreciate any advice or suggestions! ...

Ensuring draggable div remains fixed while scrolling through the page

I am currently working on creating a draggable menu for my website. The menu is functional and can be moved around the page as intended. However, I have encountered an issue where the menu disappears when scrolling down the page due to its position attrib ...

The React component fails to display updates following a state change

Greetings, I am currently facing an issue with re-rendering the component. Below is the code for the initial screen where a custom component is being utilized: class Ahelle extends React.Component{ constructor(props){ super(props) this. ...

Why isn't this setState function activating?

I am working on creating a versatile notification React component for my application that can be accessed from any part of the code. I have written the following code, where I am attempting to find a workaround for exporting the showNotif function: func ...

What sets apart .addEventListener and .on() when it comes to including an event in Bootstrap 5?

I'm currently attempting to attach a listener to my modal in order to implement a certain behavior each time the modal is opened. As per the guidance from Bootstrap 5 documentation, you can achieve this by using: https://getbootstrap.com/docs/5.2/com ...

"Figuring out a way to include a link with each image in a react-s

I am currently working on a project in Gatsby and encountering some issues with the homepage banner. I am using react-slick which seems to be functioning fine, but when I try to add content on top of each image, it causes some problems. Specifically, setti ...

Is React Typescript compatible with Internet Explorer 11?

As I have multiple React applications functioning in Internet Explorer 11 (with polyfills), my intention is to incorporate TypeScript into my upcoming projects. Following the same technologies and concepts from my previous apps, I built my first one using ...