Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Align button to textarea corner

I have a text_area and I want a two of buttons to be below the text_area and aligned with the text area’s bottom right corner to be like:

expected

What I have so far is below code:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

form with modal

<%= form_for @note, :url => registrant_notes_path(@registrant), remote: true do |f| %>
  <div class="text-note">
    <%= f.label :body, 'Add note' %>
    <%= f.text_area :body, maxlength: 1000, id: "review_text" %>
    <%= show_errors(@note, :body) %>

    <div class="counter-text">
      <span id="counter" data-maximum-length="1000"><%= 1000 %></span> chars left / 1000 character max
    </div>
    <%= f.hidden_field :administrator_id, value: current_login.id %>
    <%= f.hidden_field :registrant_id, value: @registrant.id %>
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    <%= f.submit "Save", class: "btn btn-primary" %>
  </div>
<% end %>

css

.modal-footer {
    border-top: 0 none;
}

.counter-text {
  border-top: 0 none;
  text-align: right;
}

#review_text {
  min-height: 54px;
  width: 100%;
}

>Solution :

add padding-right:0; to .moadal-footer

 .modal-footer {
 border-top: 0 none;
  padding-right:0;
 }

add modal-footer section after div modal-body

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Modal Example</h2>
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Modal Header</h4>
        </div>
        <div class="modal-body">
          <p>Some text in the modal.</p>
        </div>
        <div class="modal-footer" style="padding-right:0">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
           <button type="submit" class="btn btn-primary">Submit</button>
        </div>
      </div>
      
    </div>
  </div>
  
</div>

</body>
</html>

end

 <div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    <%= f.submit "Save", class: "btn btn-primary" %>
  </div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading