小编mon*_*jer的帖子

每个浏览器的默认字体大小是16px吗?为什么?

CSS3定义了一个font-size被调用的新长度单位rem.这允许我们计算元素font-size与根元素(html元素)的关系.

为了font-size更容易计算,我们通常假设根元素font-size16px,因此CSS通常最终会像这样:

html { font-size:62.5%; } // 10px = 16px * 0.625
Run Code Online (Sandbox Code Playgroud)

因此,每个元素高度与例如rem相对10px

p{ font-size : 1.4rem ;} // 14px = 10px * 1.4 
Run Code Online (Sandbox Code Playgroud)

我无法找到为什么我们假设我们可以乘以16px?我们怎样才能相信每个浏览器都具有相同的基值16px?是否有关于预定义的标准描述16px

参考

html css css3

20
推荐指数
1
解决办法
1万
查看次数

HTTP请求标头X-Requested-With来自哪里

我们知道X-Requested-With,如果http请求来自Ajax,我们可以使用http请求标头来判断.

许多javascript框架会X-Requested-With在其ajax请求中自动添加标头,例如jQuery Ajax,Prototype Ajax.而作为HTTP标头字段列表的维基说,这X-Requested-With是一个非标准的请求标头.

谷歌多次后,我还没有找到谁首先提出X-Requested-With请求标题.

所以我想知道是否还有其他人知道它的X-Requested-With来源?谢谢...

xmlhttprequest http-headers

9
推荐指数
1
解决办法
1万
查看次数

如何更改UIAlertController的文本框边框颜色

我尝试在ios中使用UIActionController来显示文本字段,我想知道如何更改文本字段边框颜色.

我的代码是:

- (void)showChangePasswordAlertView
{
    UIAlertController *actionVC = [UIAlertController alertControllerWithTitle:@""
                                                                  message:@"Change your password."
                                                           preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK"
                                                 style:UIAlertActionStyleDefault
                                               handler:^(UIAlertAction *action) {
                                               }];
    [actionVC addAction:action];

    action = [UIAlertAction actionWithTitle:@"Cancel"
                                      style:UIAlertActionStyleDefault
                                   handler:^(UIAlertAction *action) {
                                  }];
    [actionVC addAction:action];

    [actionVC addTextFieldWithConfigurationHandler:^(UITextField *textField) {
       textField.placeholder = @"old password";
       textField.borderStyle = UITextBorderStyleNone;
       textField.layer.borderColor = [UIColor redColor].CGColor;
       textField.layer.borderWidth = 1.0 ;
      textField.secureTextEntry = YES ;
    }];

    [actionVC addTextFieldWithConfigurationHandler:^(UITextField *textField) {
        textField.placeholder = @"new password";
        textField.borderStyle = UITextBorderStyleNone;
        textField.secureTextEntry = YES ;
    }];

    [actionVC addTextFieldWithConfigurationHandler:^(UITextField *textField) …
Run Code Online (Sandbox Code Playgroud)

uitextfield

7
推荐指数
1
解决办法
1008
查看次数

如何使用UIViewKeyframeAnimationOptionRepeat选项停止[UIView animateKeyframesWithDuration]的动画

我想在我的视图中添加一个心跳效果,一种方法是使用UIView的动画方法如下:

- (void)heartBeating
{
    UIView *panel;
    NSTimeInterval during = 0.8;
    [UIView animateKeyframesWithDuration:during delay:0.0
                             options:UIViewKeyframeAnimationOptionCalculationModeLinear|UIViewKeyframeAnimationOptionRepeat
                          animations:^{
                              [UIView addKeyframeWithRelativeStartTime:0.0 relativeDuration:0.4 animations:^{
                                  panel.transform = CGAffineTransformMakeScale(1.2, 1.2);
                              }];
                              [UIView addKeyframeWithRelativeStartTime:0.4 relativeDuration:0.6 animations:^{
                                  panel.transform =CGAffineTransformIdentity ;
                              }];

                          } completion:^(BOOL finished) {

                          }];
}
Run Code Online (Sandbox Code Playgroud)

问题是:如果我想在一个动作中停止动画,例如,一个Stop butotn轻敲,我该怎么做.

我知道我可以通过创建实现相同的效果CAKeyFrameAnimation并将其添加到视图'CALayer.但我想知道如何处理UIView的动画方法.谢谢.

animation uiview

3
推荐指数
1
解决办法
1134
查看次数