Is there a way to make my button and placeholder adapt for responsive design?

I seem to be having trouble with my button and placeholder image not being responsive. I have placed them inside a form, and you can see an example of the issue below:

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

The images are getting cut off when I minimize the screen size.

I have tried using the "fluid" class but it doesn't seem to work as expected when resizing the screen.

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

<div class="col-md-6">
  <form id="form" class="needs-validation" action="" novalidate>
    <div class="form-group row">
      <label for="validationName" class="col-2 col-form-label">Name:</label>
      <div class="col-10">
        <input name="validationName" type="text" class="form-control" id="validationName" placeholder="Company Name" required>

      </div>
    </div>
    <div class="form-group row">
      <label for="validationEmail" class="col-2 col-form-label">Email:</label>
      <div class="col-10">
        <input name="text2" type="email" class="form-control" id="validationEmail" placeholder="{email}" pattern="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" required>

      </div>
    </div>


   
    <div style=" left: 500px; top: 10px; position: absolute;">
      <img src="https://mdbootstrap.com/img/Photos/Others/placeholder-avatar.jpg" class="img-fluid" id="output" width="100" height="100" style="border-radius: 50%;" />
      <br/><br>
      <!-- <label for="file" style="cursor: pointer; padding-left: 3px; padding-top: 1px; position: static; margin-left: 45px; height: 30px;">Select Image</label> -->
    </div>





    <button style="left: 525px; top: 120px; position: absolute;" type="submit" class="submitb btn btn-primary">Submit</button>


  </form>

How can I modify the code to move the image and button to the left side of the screen when the resolution is reduced to prevent them from being cut off?

Answer №1

According to the Bootstrap 4 documentation:

The Bootstrap framework allows images to be responsive by using the .img-fluid class. This class applies max-width: 100%; and height: auto; to the image, enabling it to scale according to its parent element.

To make your image responsive, simply add the class img-fluid to the <img> tag:

<img src="https://mdbootstrap.com/img/Photos/Others/placeholder-avatar.jpg" id="output" class="img-fluid" width="100" height="100" style="border-radius: 50%;" />

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

Text that is selected within a contenteditable div: Find the beginning and end points of the highlighted text

<div contenteditable="true">This text is <b>Bold</b> not <i>Italic</i> right?</div> For instance, if the text appears in a bold format, but not italic and the user selects it, how can I determine the exact position ...

Unable to eliminate the right margin using CSS

I'm having an issue with the live server where I've tried adjusting various elements like setting margin-right to 0px, decreasing padding, etc., but nothing seems to fix the problem. Everything is scaled properly but there's an overflow that ...

Is there a way to update a portion of a webpage to show different content after a form is successfully submitted?

I have implemented a newsletter subscription form on my web app, utilizing Mailchimp to manage the list of subscribers. The process is running smoothly with the Mailchimp API seamlessly adding subscribers from my site to the audience list on Mailchimp. Th ...

How can I navigate to column 3 of an HTML table using XPATH with Selenium Webdriver in Python?

I have extracted the text from the Name column of an HTML table using XPATH, which corresponds to column index [1]. Now, I need to navigate to the 3rd column with index [3] using XPATH, but I'm not sure how to proceed. Here is my current XPATH: //ta ...

Troubleshooting Django: Missing CSS File Issue

I spent a considerable amount of time trying to resolve the issue with loading all my static files. Eventually, I found a solution that allowed SVGs to load properly, but my CSS files were still not loading. Below are snippets from my settings.py file (sh ...

Utilizing a Text Box, HTML, and Javascript to Showcase a PDF within an iFrame

Is there a way to add a form on a Sharepoint page that prompts users to input the URL of a PDF document, which will then be displayed in an iFrame on the same page? I've come across some code that achieves this with an image, but I'm struggling ...

What could be causing my THREE.js Documentation Box to malfunction?

I am a newcomer trying to get the hang of THREE.js. I delved into the THREE.js Documentation and attempted to implement the code, but when I loaded my HTML page, it appeared blank. I am at a loss for what to do next. I utilized Visual Studio Code for codin ...

Converting hierarchical JSON data into a table with rowspan using Angular

I am facing a challenge in creating a table using nested JSON obtained from an API. I am unsure how to dynamically merge cells when needed, especially since the JSON structure can be nested up to 6 or 7 levels. Desired Table : Expected Table Current Ou ...

What could be the reason behind CSS internal style not working while inline style is functioning properly?

Here is the code I am currently working with. It seems that there may be an issue, but I'm not sure what it could be. The first part contains internal CSS and below is inline CSS which appears to be functioning properly. My suspicion is that the image ...

Animating a Canvas to Follow Mouse Coordinates

I am looking for a way to animate a circle moving towards specific coordinates, similar to the game . I have attempted using the jquery animate() function, but it is too slow due to the constant updating of the target coordinates. Is there a faster metho ...

Enhancing the appearance of bootstrap classes with custom styles

My current code snippet is: <div class="col-md-2 col-lg-offset-2 col-sm-4 col-xs-offset-1 col-sm-offset-0 col-md-offset-1 col-xs-10"> I am looking to include a custom style (such as padding: 20px) that will only be applied when col-sm-4 is being us ...

JavaScript can retrieve the default page name that is hidden within the browser's URL

When a URL is entered without a specific file name at the end, such as "www.google.com," the server typically serves a default file like "index.html" or "default.aspx." In this scenario, if the browser displays "www.google.com," I am looking to extract the ...

What is the best way to modify the selection text background with CSS?

Does anyone know the method for modifying the selection text background in CSS? Many modern websites opt for a personalized background color instead of the traditional blue? ...

Difficulty linking CSS to HTML in a Flask web application

My HTML/CSS file is pretty straightforward: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8"> <meta name=&quo ...

Using Javascript's Speech Recognition to activate a button

I am new to using JavaScript Speech Recognition and decided to work with the Annyang library. My goal is to automatically trigger the "show date" button when the user says 'hello', without actually clicking the button. However, I've been fac ...

Ways to apply hover effects to an element located outside of a div

Is there a way to make a sub-menu appear outside of the elements div that I'm hovering over? I've tried various methods, but none have been successful so far. The design requires the submenu to be outside of the links div. What is the most effec ...

What is the best way to align a character at the center of a box with CSS?

Essentially, how can I vertically center a character within a box based solely on its bounding box dimensions, disregarding its depth and ascent? Here is a simple HTML example: .box { display: inline-block; width: 1em; height: 1em; line-height: ...

Tips for assigning an event to a variable in JavaScript

Here is my javascript code snippet: function drag(ev){ var x= ev.dataTransfer.setData("Text",ev.target.id); } I am trying to pass a variable within this event so that I can perform a specific action. However, the current implementation is not worki ...

The Firebase JQuery .on method is incrementally updating individual values in an array instead of updating them all simultaneously

I am trying to update the values of the orders placed by users on the Corporate's page without a refresh. I have implemented the jQuery .on method for this purpose. However, the values are being returned one by one from the array created for the order ...

Animating a character's movement along a bezier curve using HTML5 canvas

Brand new to canvas and animations. What's the reason this (Fiddle) won't work with a sprite while this other one (Fiddle) works seamlessly with a rectangle fill? What element am I overlooking here: ctx.drawImage(img, 10, 10, 13, 50); It does ...