html - 如何设置通知警报的高度和宽度

标签 html css

我有一个注册页面。当我完成注册并单击保存按钮时,我会收到“注册成功”的通知。我使用 bigbox.css 和 humane.js 作为我的通知。我很容易收到通知,但问题是通知有默认的 height 和 width 。如何自定义其高度和宽度?

   var ratPack = $.sammy(function() {
        this.post('#/cart', function() {
           var firstname = this.params['firstName'];
    var lastname = this.params['lastName'];
    var organisation = this.params['organisation'];
    var email = this.params['email'];
    var password = this.params['password'];
    var confirmPassword = this.params['confirmPassword'];
    var baseurl = this.params['url'];
           $.ajax({
        type : 'POST',
        url :'/costing-
     tool/api/registration/'+firstname+'/'+lastname+'/'+email,
        success : function() {
         document.getElementById('light').style.display='none';
             document.getElementById('fade').style.display='none';
             humane.log("Registration Successful");//humane used here
                    },
        error:function(){
            alert($('#emailError'));
            $('#emailError').text("This E-Mail is already registered")
        }
   });
});
  });

bigbox.css

 html,
  body {
   min-height: 100%;
  }
.humane,
.humane-bigbox {
 position: fixed;
 -moz-transition: all 0.3s ease-out;
 -webkit-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
 transition: all 0.3s ease-out;
 z-index: 100000;
 filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
  }
 .humane,
 .humane-bigbox {
  font-family: Ubuntu, Verdana, sans-serif;
  line-height: 40px;
  font-size: 20px;
  top: 25%;
   left: 25%;
   opacity: 0;
   width: 50%;
   min-height: 40px;
  padding: 30px;
  text-align: center;
   background-image: 
    url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADICAYAAAAp8ov1
   AAAABmJLR0QA/wD/AP+gvaeTAAAAc0lEQVQokb2RQQ6EMAwDx/7/n80BtIEC3RYh
   LlXrVLGTAYiBWBIGtkPSP01SfreTVoV5re9Rcee1scwDk9NurbR6
  2sZJcpzy9O+2X5KsXabyPaQFYNuvkqkRviDTp9Vs8opC0TpkHvJtVjeReW/
  5kEyX1gKeLEKE9peeWAAAAABJRU5ErkJggg==');
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #000),
   color-stop(1, rgba(0,0,0,0.9))) no-repeat;
 background: -moz-linear-gradient(top, #000 0%, rgba(0,0,0,0.9) 100%) no-repeat;
 background: -webkit-linear-gradient(top, #000 0%, rgba(0,0,0,0.9) 100%) no-repeat;
 background: -ms-linear-gradient(top, #000 0%, rgba(0,0,0,0.9) 100%) no-repeat;
 background: -o-linear-gradient(top, #000 0%, rgba(0,0,0,0.9) 100%) no-repeat;
 background: linear-gradient(top, #000 0%, rgba(0,0,0,0.9) 100%) no-repeat;
*background-color: #000;
 color: #fff;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
 border-radius: 15px;
 text-shadow: 0 -1px 1px #ddd;
 -moz-box-shadow: 0 15px 15px -15px #000;
 -webkit-box-shadow: 0 15px 15px -15px #000;
  box-shadow: 0 15px 15px -15px #000;
 -moz-transform: scale(0.1);
 -webkit-transform: scale(0.1);
 -ms-transform: scale(0.1);
 -o-transform: scale(0.1);
 transform: scale(0.1);
 }
  .humane p,
  .humane-bigbox p,
  .humane ul,
  .humane-bigbox ul {
   margin: 0;
   padding: 0;
   }
   .humane ul,
   .humane-bigbox ul {
   list-style: none;
    }
     .humane.humane-bigbox-info,
     .humane-bigbox.humane-bigbox-info {
      background-image:  url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA
         EAAADICAYAAAAp8ov1AAAABmJLR0QA/wD/AP+gvaeTAAAAQElEQVQokW
         NgYEj5z8TAwPCfiYGBgQGVIEKMTG2DTYwRVez/IHIaNcUGyBnYg
         pORel6gpvFEJhBqpxIaG8/AAADsKDq/HhYQ2AAAAABJRU5ErkJggg==');
        background: -webkit-gradient(linear, left top,
      left bottom, color-stop(0, #000064),   color-stop(1, rgba(0,0,100,0.9))) no-
     repeat;
     background: -moz-linear-gradient(top, #000064 0%, rgba(0,0,100,0.9) 100%) no-
      repeat;
     background: -webkit-linear-gradient(top, #000064 0%, rgba(0,0,100,0.9) 100%) no- 
      repeat;
      background: -ms-linear-gradient(top, #000064 0%, rgba(0,0,100,0.9) 100%) no-
     repeat;
     background: -o-linear-gradient(top, #000064 0%, rgba(0,0,100,0.9) 100%) no-repeat;
     background: linear-gradient(top, #000064 0%, rgba(0,0,100,0.9) 100%) no-repeat;
     *background-color: #030;
       }
      .humane.humane-bigbox-success,
       humane-bigbox.humane-bigbox-success {
      background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUg
       AAAAEAAADICAYAAAAp8ov1AAAABmJLR0QA/wD/AP+gvaeTAAAAP
      klEQVQokWNgSGH4z8TAACEYUAkixMjUNsjEGFHF/g8ip1FVbGC
      cgS04GannBaoaT1wCwWkvmXbQ2HgGBgYA8Yw6v+m4Kh8AAAAASUVORK5CYII=');
       background: -webkit-gradient(linear, left top, 
     left bottom, color-stop(0,       #006400), color-stop(1, rgba(0,100,0,0.9))) no-
     repeat;
     background: -moz-linear-gradient(top, #006400 0%, rgba(0,100,0,0.9) 100%) no-
     repeat;
    background: -webkit-linear-gradient(top, #006400 0%, rgba(0,100,0,0.9) 100%) no-
    repeat;
     background: -ms-linear-gradient(top, #006400 0%, rgba(0,100,0,0.9) 100%) no-repeat;
     background: -o-linear-gradient(top, #006400 0%, rgba(0,100,0,0.9) 100%) no-repeat;
     background: linear-gradient(top, #006400 0%, rgba(0,100,0,0.9) 100%) no-repeat;
    *background-color: #030;
    }
    .humane.humane-bigbox-error,
    .humane-bigbox.humane-bigbox-error {
     background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA
       AEAAADICAYAAAAp8ov1AAAABmJLR0QA/wD/AP+gvaeTAA
       AAPklEQVQokWNIYWD4z8QAJRhQCSLEyNQ2uMQYUcX+DyKnUVd
     sQJyBLTgZqecF6hpPVALBaS+ZdtDYeAYGBgYA9vA6v4OR3MkAAAAASUVORK5CYII=');
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #640000),
     color-stop(1, rgba(100,0,0,0.9))) no-repeat;
     background: -moz-linear-gradient(top, #640000 0%, rgba(100,0,0,0.9) 100%) no-
     repeat;
      background: -webkit-linear-gradient(top, #640000 0%, rgba(100,0,0,0.9) 100%) no-
      repeat;
      background: -ms-linear-gradient(top, #640000 0%, rgba(100,0,0,0.9) 100%) 
     no-repeat;
      background: -o-linear-gradient(top, #640000 0%, rgba(100,0,0,0.9) 100%) no-repeat;
     background: linear-gradient(top, #640000 0%, rgba(100,0,0,0.9) 100%) no-repeat;
    *background-color: #300;
   }
   .humane.humane-animate,
   .humane-bigbox.humane-bigbox-animate {
    opacity: 1;
    -moz-transform: scale(1);
    -webkit-transform: scale(1);
    -ms-transform: scale(1);
    -o-transform: scale(1);
    transform: scale(1);
    }
    .humane.humane-animate:hover,
    .humane-bigbox.humane-bigbox-animate:hover {
     opacity: 0.6;
     -moz-transform: scale(0.8);
     -webkit-transform: scale(0.8);
    -ms-transform: scale(0.8);
    -o-transform: scale(0.8);
     transform: scale(0.8);
     }
     .humane.humane-js-animate,
      .humane-bigbox.humane-bigbox-js-animate {
      opacity: 1;
     -moz-transform: scale(1);
     -webkit-transform: scale(1);
      -ms-transform: scale(1);
       -o-transform: scale(1);
      transform: scale(1);
       }
      .humane.humane-js-animate:hover,
       .humane-bigbox.humane-bigbox-js-animate:hover {
       opacity: 0.6;
       filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=60);
     }

最佳答案

我看到您对 CSS 非常陌生,但是您可以将大框宽度更改为父元素宽度的 50%。关于 bigbox 高度,默认情况下设置为自动(这就是为什么您现在看不到它的原因)并且您将 min-height 设置为 40px,以防 bigbox 中没有列表或文本。

.humane-bigbox {
   font-family: Ubuntu, Verdana, sans-serif;
   line-height: 40px;
   font-size: 20px;
   top: 25%;
   left: 25%;
   opacity: 0;
   width: 50%; <- This is the width value
   min-height: 40px;
   ...
}

进一步阅读:

关于html - 如何设置通知警报的高度和宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13760533/

相关文章:

jquery - IE 7/8 专有过滤器和 jQuery 的问题

html - 如何处理 SCSS/SASS 中的悬停

jquery - MVC 主题和 DatePicker

css - 在较小的 div 中如何让背景图像覆盖整个屏幕

javascript - 在 IndexedDB 中存储图像文件

html - 匹配不包含特定值的 HTML 表行 ( <tr> ) 的正则表达式

html - CSS:右列不再位于菜单栏下方

html - 如何让月份输入框的内容居中?

php - 将文本字段的值添加到另一个文本字段

html - IE8 支持 CSS 媒体查询