Aligning an image next to a login form with the help of materializecss

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

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

To view the complete code, visit http://codepen.io/anon/pen/BjqxOq

I have implemented a login page using materializecss and I am looking to align an image with the login form. However, when I attempt to do so, the image and the form appear stacked on top of each other as shown in the screenshot.

I tried adding a class="right align" to the image to move it to the right side, but I couldn't align the login form to be in line with the image.

   <div>
    <img src="images/one.png" height="480" width="580">
   </div>

   <div id="login-page" class="row">
    <div class="col s12 z-depth-6 card-panel">
     <form class="login-form">
      <div class="row">
       <div class="input-field col s12 center">
         <h3 class="left login-form-text">Login</h3>
       </div>
     </div>

    <div class="row margin">
      <div class="input-field col s4">
        <i class="mdi-social-person-outline prefix"></i>
         <input class="validate" id="email" type="email" >
          <label for="email" data-error="wrong" data-success="right" class="center-align">Email</label>
      </div>
     </div>

    <div class="row margin">
      <div class="input-field col s4">
        <i class="mdi-action-lock-outline prefix"></i>
         <input id="password" type="password" >
         <label for="password">Password</label>
      </div>
    </div>

    <div class="row">         
      <div class="input-field col s12 m12 l12  login-text">
        <input type="checkbox" id="remember-me" />
          <label for="remember-me">Remember me</label>
      </div>
    </div>

    <div class="row">
      <div class="input-field col s1">
        <a href="" class="btn waves-effect waves-light grey darken-2 col s12">Login</a>
      </div>
     </div>
    </div>

Answer №1

To properly structure your project, consider wrapping the form and image divs in a list. This may prove challenging due to the complexity of your project. Have you checked out this helpful post on how to position two divs side-by-side? How to get these two divs side-by-side?

Answer №2

When you mentioned aligning an image next to a login form, did you mean having the picture on the right and the form on the left?

If the form and image are the only elements on the page, have you tried placing them in an HTML list and using CSS to set the list to

display: inline-block;

?

The form should be on the left side, followed by the picture on the right.

I'm not sure if this suggestion will be helpful, but best of luck!

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

Using the ng-show directive in AngularJS allows you to pass elements in

Web Development <li ng-show="sample($event)" TestLi</li> JavaScript Functionality $scope.sample = function($event){ //$event is undefined //perform some action } I have experimented with passing the HTML element using ng-click, but I am curio ...

What is the best method for retaining the complete YQL outcome within a JavaScript object?

I am trying to store the output of my YQL Query in a JavaScript object Here is my query: SELECT * FROM html WHERE url="http://myurl.com" and xpath="/html/body/center/table[1]/tr" Can someone guide me on how to proceed? I have gone through the YQL docu ...

Guide on how to refresh the background image using the identical URL within a directive

I am looking to refresh the background image of a div using the same URL within a directive. Upon loading my view, I utilized this directive to display the image as a background for the div. app.directive('backImg', function () { var dir ...

Display a pop-up window when hovering over a table cell using HTML and JavaScript

I am currently developing a JavaScript application and came across a helpful library called qtip2. My objective is to have different information displayed when the user hovers over each cell in the table. The qtip2 library I mentioned earlier can display ...

Refreshing data causes the data to accumulate and duplicate using the .append function in Jquery

I am currently working with a dynamic table that is being populated using AJAX and jQuery. Everything seems to be functioning correctly, however, I am encountering an issue when trying to reload the data as it just continues to stack up. Below is the func ...

Looking to insert an image in the top-left corner of a div?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> <head> <script src="http://ajax.googleapis.com/ajax/libs/jq ...

Cursor customized image vanishes upon clicking anywhere on the page on a MAC in various web browsers

I am currently trying to set a custom image as the cursor using jQuery in this manner $(document).ready(function(){ $("body").css('cursor','url(http://affordable-glass.com/test/penguinSm.png),auto'); }); While this method works, ...

Div that scrolls only when children can be displayed without overflowing

I am seeking a solution to ensure that the children inside my scrollable div are only visible in their entirety. HTML <div id="container"> <div class="child"></div> <div class="child"></div> <div class= ...

What is the reasoning behind having blank space between the buttons?

Can anyone help me understand why there is visible space between the buttons in the code example provided below? Despite removing margins and paddings, the whitespace persists. <body> <div class="button-container"> <button>1& ...

What is the best way to delete a div element from a list

Check out the following code snippet. <div id="list"> <div class="a">1</div><div class="b">1</div></div> <div id="list"> <div class="a">2</div><div class="b">2</div></div> <div id= ...

When Bootstrap 4 teams up with Autoprefixer, it results in malfunctioning old iPads

.row { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; margin-right: -15px; margin-left: -15px; } Recently, we implemented Bootstrap 4 and the Flex model at my company. We'v ...

Safari not updating Angular ng-style properly

I created a simple carousel using Angular and CSS animations which works well in Chrome. However, I recently tested it in Safari and noticed that the click and drag functionality does not work. I've been trying to fix this issue for days and could use ...

The text is not meticulously arranged within the designated span

My text-align (center) property doesn't seem to be working correctly with the following code snippet: <span class="info">&nbsp;i&nbsp;<span id="uitleg_itje">Bla bla. </span></span> The CSS for the info class is as fo ...

Tips on how to customize an HTML form submission appearance

Take a look at my file upload form below: <form action="upload.php" method="post" enctype="multipart/form-data"> <input type="file" name="filetoupload" id="filetoupload" onchange="this.form.submit();"> </form> I am trying to figure out ...

Concealed checkbox value in jQuery

I have a problem with setting the hidden checkbox "marketingPhone" to TRUE when the "marketingAAA" checkbox is checked as true. This part works fine. However, if any other checkbox on the page is set to TRUE, then it also sets "marketingPhone" to TRUE. I ...

Utilizing data attributes instead of IDs for connecting buttons and tabs in Javascript tab navigation

I'm currently exploring a new approach to creating Javascript tabs by utilizing data attributes instead of IDs to connect the tab with its content. Here's the concept in action: When clicking on a <button class="tab" data-tab-trigger="1"> ...

Maximizing Efficiency: Utilizing a Single Panel across Multiple HTML Files with jQueryMobile

Can a panel defined in index.html be used on another page, such as results.html? Or do I have to define the panel on every page and duplicate the HTML code on each page? Because I want the panel to be consistent across all pages. This is the panel in my ...

What is the best way to create a sticky menu bar?

I have this code snippet at the beginning of my website: <body> <div class="agile-main"> <div class="menu-wrap" id="style-1"> <nav class="top-nav"> <ul class="icon-list"> ...

Animating a CSS overlay

My goal is to design an overlay using the following HTML and CSS code snippets div.relative { position: relative; width: 400px; height: 200px; border: 3px solid #73AD21; } div.absolute { position: absolute; top: 50%; right: 0; width: 20 ...

Swap the content of one div with another div using client-side code only

Currently, I am in the process of developing my personal website. To enhance user experience, I have implemented a vertical navigation bar on the left side of the page. My goal is to replace the content of a specific div with content from other HTML files ...