Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set angular modal custom height and width

I have found a way to change the width of a angular modal, how ever I can not figure out how to set the height I want. I need the modal to be 400px width, 400px height. also I need to reposition it so it is in the center of the screen. thanks plunkr

 $scope.NewJobModal = function () {

      var modalInstance = $modal.open({
          templateUrl: 'views/modals/NewJobModal.html',
          controller: 'NewJobModalInstanceCtrl',
          windowClass: 'large-Modal',
          resolve: {
              p: function () {
                  return $scope.p;
              }
          }
      });
  };

.large-Modal .modal-dialog{
width:30%;
}
like image 878
texas697 Avatar asked Oct 04 '14 22:10

texas697


People also ask

How do you set the width and height of a modal?

Change the size of the modal by adding the . modal-sm class for small modals, . modal-lg class for large modals, or . modal-xl for extra large modals.

How can I increase my modal height?

In order to increase or decrease the modal window height and width properties of Bootstrap, you need to get the modal related classes and use desired values either in the <style> section or in your external CSS file.

How do you increase modal size in Reactstrap?

To achieve greater sizes than this, you have to use a stylesheet imported and on the Modal component itself, specifically a property called contentClassName . By writing to a separate file like styles. css and importing it, it will use those styles if the class name is put in contentClassName .

How do I change the default width of a Bootstrap modal box?

Answer: Set width for . modal-dialog element However, if you still want to customize the size of the modal window you can override the CSS width property of the . modal-dialog class to resize the default modal. Similarly, you can override the width property of . modal-sm , .


1 Answers

Two things:

1 - In the Plunkr you provided you're not attaching you .css file. Change the src to href.

2 - Then in your css file:

.large-Modal .modal-dialog{
  height: 400px;
  width:400px; 
  margin: auto;
  position: absolute;
  top:0;
  right: 0;
  bottom: 0;
  left: 0;
}
like image 86
Alan Dunning Avatar answered Nov 15 '22 10:11

Alan Dunning