小编bra*_*r19的帖子

使用正则表达式删除所有 html 属性(替换)

例如我有这样的html:

\n\n
<title>Ololo - text\xe2\x80\x99s life</title><div class="page-wrap"><div class="ng-scope"><div class="modal custom article ng-scope in" id="new-article" aria-hidden="false" style="display: block;"><div class="modal-dialog first-modal-wrapper">< div class="modal-content"><div class="modal-body full long"><div class="form-group">olololo<ul style="color: rgb(85, 85, 85);background-color: rgb(255, 255, 255);"><li>texttext</li><li>Filter the events lists by host.</li><li>Create graphs for separate hosts and for the groups of hosts.</li></ul><p style="color: rgb(85, 85, 85);background-color: rgb(255, 255, 255);">bbcvbcvbcvbcvbcvbcvbcvb</p></div></div></div></div></div></div><title>cvbcbcvbcvbcvbccb</title><div class="page-wrap"></div></div>\n
Run Code Online (Sandbox Code Playgroud)\n\n

我怎样才能从这样的html中删除所有样式类id等?

\n\n

我有这样的正则表达式:

\n\n
/<([a-z][a-z0-9]*)[^>]*?(\\/?)>/i\n
Run Code Online (Sandbox Code Playgroud)\n\n

怎么了?如何借助正则表达式删除所有html属性?

\n\n

这是小提琴:

\n\n

http://jsfiddle.net/qL4maxn0/1/

\n

html javascript regex

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

底部的按钮被切成薄片

为什么在我的按钮被切成底部?我需要它在每个角落四舍五入...现在我有这个: 在此输入图像描述 但是如果我写入橙色按钮类css属性float:left,我得到结果,我需要什么......但这是个坏主意. 在此输入图像描述 怎么以正常方式做到?

(我也使用sass + haml)

.orange-button{
  padding: 6px;
  @include gradient-background(bottom, $or1, #fbb752); 
  //background: url('button-carbon-bg.png') no-repeat, -webkit-linear-gradient(bottom, $or1, #fbb752);
  @include border-radius(5px, 5px, 5px, 5px);
  //background: transparent url('button-carbon-bg.png') no-repeat;
  border: 1px solid #d27d00;
  font-family: “Myriad Pro”, Arial, Helvetica, Tahoma, sans-serif;
  font-weight: bold;
  font-size: 16px;
  color: $or3;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .70);
  font-style: normal;
  @include box-shadow(inset 0 1px 0 rgba(255,255,255,0.5));
  border-bottom:2px solid #B16900;
}
.orange-button:hover{
  @include gradient-background(bottom, #eba641, #fcc97d); 
}
Run Code Online (Sandbox Code Playgroud)

和小提琴:http: //jsfiddle.net/Zfq73/

html css sass button

0
推荐指数
1
解决办法
88
查看次数

AngularJS在第一个数组中找到对象,而第二个数组中没有出现该对象

假设我有这两个对象:

第一:

[
    {
        id: "123",
        title: "123",
        options: []
    },
    {
        id: "456",
        title: "456",
        options: [
            {
                id: "0123",
                title: "0123",
                options: []
            }
        ]
    },
    {
        id: "789",
        title: "789",
        options: []
    },
]
Run Code Online (Sandbox Code Playgroud)

第二个

[
    {
        id: "123",
        title: "123",
        options: []
    },
    {
        id: "789",
        title: "789",
        options: []
    },
]
Run Code Online (Sandbox Code Playgroud)

你可以在第二个数组中看到我错过了这个部分:

{id:"456",标题:"456",选项:[{id:"0123",标题:"0123",选项:[]}]}

如何在角度中迭代并找到缺失的元素是正确的和更好的?

javascript arrays angularjs

0
推荐指数
1
解决办法
474
查看次数

CSS:将ul li项目对齐到中心(带边距)而不使用flex模型

我有这样的代码:

<ul class="tiles">
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
</ul>
Run Code Online (Sandbox Code Playgroud)

和css:

ul.tiles{
    width: 220px;
    height: 200px;
    list-style-type: none;
    background: #cecece;
    padding: 0;
}

li{
    display: inline-block;
    width: 50px;
    height: 50px;
    background: #8ac249;
    text-align: center;
    line-height: 50px;
    margin: 5px;
    float: left;
}
Run Code Online (Sandbox Code Playgroud)

看起来如此:

在此输入图像描述

将它更改为这样的模型是真实的(没有弹性框):

在此输入图像描述

如何?

html css flexbox

0
推荐指数
1
解决办法
1120
查看次数

标签 统计

html ×3

css ×2

javascript ×2

angularjs ×1

arrays ×1

button ×1

flexbox ×1

regex ×1

sass ×1