小编Ser*_*rge的帖子

CSS3中的背景速记顺序

关于CSS3 背景中的选择器的正确顺序,HTML5微软认证中存在一些问题...但是我搜索,搜索了......但是找不到某个地方有效的参考,这个简写中的实际顺序优先级(如果有的话) )...

关于这个问题的W3C建议在这个问题上并不十分明确(至少,找到这些信息并不明显)....

是古老的CSS2"看,我说唱"(CIRAP)acronim或多或少吸引人......但即使有W3C没有明确表达订单?!...

如果没有人知道标准,那么这些问题在证书中的含义是什么?最后,CSS3中的正确顺序是什么?

他们的例子令人困惑......以前,以下让人相信顺序是 CIRAPCOS

另一个例子显示了等价:

div { background: padding-box url(paper.jpg) white center }
div {
    background-color: white;
    background-image: url(paper.jpg);
    background-repeat: repeat;
    background-attachment: scroll;
    background-position: center;
    background-clip: padding-box;
    background-origin: padding-box;
    background-size: auto auto }
Run Code Online (Sandbox Code Playgroud)

然后规范提到:

给定一个有效的声明,对于每一层,速记首先设置每个"背景图像 ","背景位置 ","背景大小 ","背景重复 ","背景原点 ","背景" 的相应图层.- 将''和'background- attachment ' 剪辑到该属性的初始值,然后在声明中指定为此图层指定的任何显式值.最后,'background- color '设置为指定的颜色(如果有),否则设置为其初始值.

所以,这就是我们获得的方式 IPSROClACo

html css html5 w3c css3

9
推荐指数
2
解决办法
6592
查看次数

如何通过ASP.NET Core中的链接进行发布

我尝试通过链接发布到SetLanguage操作,但是不确定如何完成以下代码:

<form id="selectLanguage" asp-controller="Home" asp-action="SetLanguage" asp-route-returnUrl="@Context.Request.Path" method="post" role="form">
    @foreach (var culture in cultures) {
        <div>                
            <a href="?culture=@culture.Name">@culture.Name</a>
        </div>
    }
 </form>
Run Code Online (Sandbox Code Playgroud)

我应该使用form还是有直接方法culture : 'EN'通过例如发送带有参数的POST ?

是否@Url.Action(action: "SetLanguage", controller:"Home", values: new { culture = culture.Name }, protocol:"POST")做的工作?

我的控制器代码是

[HttpPost]
public IActionResult SetLanguage(string culture, string returnUrl)
{
    Response.Cookies.Append(
        CookieRequestCultureProvider.DefaultCookieName,
        CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)),
        new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) }
    );

    return LocalRedirect(returnUrl);
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-core asp.net-core-1.1

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

无法启动调试适配器:VS 尝试连接到随机端口

我有一个 asp.net core (.net5) 项目,当我启动它时,它会在延迟后系统地抛出错误,然后关闭调试。

我有以下启动设置:

{
  "iisSettings": {
    "windowsAuthentication": true,
    "anonymousAuthentication": false,
    "iisExpress": {
      "applicationUrl": "http://localhost:50868",
      "sslPort": 44363
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "Kestrel": {
      "commandName": "Project",
      "dotnetRunMessages": "true",
      "launchBrowser": true,
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我以“Kestrel”的身份在调试模式下启动项目

发生一个或多个错误。

无法启动调试适配器。输出窗口中可能会提供其他信息。

无法连接到运行时进程,10000 毫秒后超时 - (原因:无法连接到目标:连接 ECONNREFUSED 127.0.0.1:55743)。

在此输入图像描述

看起来它确实尝试连接到随机端口,就像127.0.0.1:55743项目设置为在https://localhost:50015000 或 5000 处 启动浏览器时一样在此输入图像描述

似乎与此问题相关https://github.com/dotnet/aspnetcore/issues/28113

附言。调试在Edge上运行良好(我通常在Chrome中工作),我想如果你遇到这样的问题,需要更改浏览器......

.net visual-studio asp.net-core visual-studio-2019 .net-5

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

MVC 5中的"CacheProfile"

我是MVC的初学者,我有一个项目,从MVC2转换到最新版本的MVC.我读了一些关于MVC 4的书,所以我开始理解主要的机制.

但是,在转换我的MVC 2解决方案时,我遇到了一个属性问题:OutputCache.

通过例如.我有多个这样的动作(属性可能会有所不同):

[OutputCache(CacheProfile = "ProductImage")]
public ActionResult GetImage(Guid elementId, int imgtype)
Run Code Online (Sandbox Code Playgroud)

在Web.Config我有"缓存> outputCacheSettings> outputCacheProfiles>":

<add name="ProductImage" duration="5" varyByParam="elementId,imgtype" />
Run Code Online (Sandbox Code Playgroud)

并在输出中获取以下异常:

子操作的OutputCacheAttribute仅支持Duration,VaryByCustom和VaryByParam值.请不要为子操作设置CacheProfile,Location,NoStore,SqlDependency,VaryByContentEncoding或VaryByHeader值.

据我所知,问题只出现在儿童行动中.

  • 还有另一种方法可以在最新的MVC中使用缓存配置文件吗?
  • 有没有办法确定该动作是否为子动作才能修改该动作?

.net asp.net-mvc caching outputcache asp.net-mvc-5

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

将绝对 div 移到父级之外

是否可以将绝对定位移动div到父边界之外?

我尝试过(较少)left:calc(~'0%-15px')但似乎不起作用:)

.dif-links {
    background: pink; width: 25px; height: 100px; 
    position: absolute; text-align: center;
    left:calc(~'0%-15px')
}
Run Code Online (Sandbox Code Playgroud)

我有一篇文章,我想在文章正文之外维护“共享”div,这就是我使用绝对位置的原因,但现在将其移动到父级的左侧似乎很复杂......

在此处输入图片说明

这是我的笔

css

7
推荐指数
2
解决办法
8220
查看次数

在材料表页脚中包含按钮和分页器

我使用Angular Material Table,并且在表的页脚行中需要一个命令按钮和该表的分页器,如下所示 在此处输入图片说明

我的代码实际上是这样的

<div class="example-table-container mat-elevation-z8">

  <table mat-table [dataSource]="dataSource" multiTemplateDataRows>
    <!-- DataSource's displayedColumns -->
    <ng-container matColumnDef="{{column}}" *ngFor="let column of displayedColumns">
      <th mat-header-cell *matHeaderCellDef> {{column}} </th>
      <td mat-cell *matCellDef="let element"> {{element[column]}} </td>
    </ng-container>


    <!-- Exporter column -->
    <ng-container matColumnDef="exporter">
      <td mat-footer-cell *matFooterCellDef colspan="2">
        <button class="btn btn-primary" (click)="exportCsv(dataSource)">
          <i class="material-icons" title="Exporter en CSV">save_alt </i>
        </button>
      </td>
    </ng-container>

    <!-- Paginator column -->
    <ng-container matColumnDef="paginator">
      <td mat-footer-cell *matFooterCellDef colspan="3">
        <mat-paginator [pageSizeOptions]="[5,10,20]" showFirstLastButtons></mat-paginator>
      </td>
    </ng-container>

    <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
    <tr mat-row *matRowDef="let element; columns: displayedColumns;"></tr> …
Run Code Online (Sandbox Code Playgroud)

pagination angular-material angular angular-material-table

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

在C#中创建动态扩展方法?

是否可以解决此错误:

public static class LayoutExtensions
{
    /// <summary>
    /// Verifies if an object is DynamicNull or just has a null value.
    /// </summary>
    public static bool IsDynamicNull(this dynamic obj)
    {
        return (obj == null || obj is DynamicNull);
    }
Run Code Online (Sandbox Code Playgroud)

编译时间

Error: The first parameter of an extension method 
       cannot be of type 'dynamic'  
Run Code Online (Sandbox Code Playgroud)

c# .net-4.0

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

CSS 中的条件多列

我有一个包含一些子菜单的菜单,就像这个

.menu {
  position: absolute;
  background: yellow;
  margin-top: 2em;
}
header {
  font-size: 20px;
}
ul {
  -moz-column-count: 2;
  -moz-column-gap: 10px;
  -webkit-column-count: 2;
  -webkit-column-gap: 20px;
  column-count: 2;
  column-gap: 10px;
  list-style: none;
  padding: 0;
}
li:nth-child(odd) {background: lightblue; }
li:nth-child(even) {background: lightyellow; }
div:not(.main) {
  display: inline-block;
  position: relative;
}
Run Code Online (Sandbox Code Playgroud)
<div>menu one
  <div class="menu">
    <header>menu one header</header>
    <ul>
      <li>Item one</li>
      <li>Item two 2</li>
      <li>Item tree</li>
      <li>Item four</li>
      <li>Item five</li>
      <li>six</li>
      <li>Item 7</li>
    </ul>
  </div>
</div>
<div>menu two</div>
Run Code Online (Sandbox Code Playgroud)

仅当.menu>ul列表中有 4 …

css

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

在ASP.NET Core中显示只读字段

我是ASP.NET Core的新手,想问一下在wa视图中显示一个字段.我有一个

class Person { 
    public string Name {get; set;} 
    public string Nickname {get; set;} 
}
Run Code Online (Sandbox Code Playgroud)

通常,在EditPersonView中,我这样做

<input asp-for="Name" class="form-control" />
<input asp-for="Nickname" class="form-control" />
Run Code Online (Sandbox Code Playgroud)

显示字段.

但在我的EditPerson视图中,我需要显示Name为只读和Nickname可编辑字段.

Name不应该在一个文本框(甚至只读),而是在标签DIV ...

是否有标准方法来显示这些字段?

我不希望将该字段更新回模型或DB,我只需要阅读该字段.

c# asp.net-core asp.net-core-tag-helpers

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

Visual Studio 灰色文本背景,如何去除?

我在cshtml文件中 有以下内容在此处输入图片说明

没选,就是这个样子,灰色的文字背景。

如何在“字体和颜色”设置中理解此文本是什么,并将其重置为白色/透明的正常背景?

在此处输入图片说明

.net visual-studio razor visual-studio-2017

6
推荐指数
2
解决办法
1003
查看次数