我正在开发一个购物车插件,并计划为客户创建一个新的用户角色。
我的问题是如何创建自定义功能,以便我可以将这些自定义功能分配给新的用户角色,此答案提供了一种创建新功能的方法,但这只是原始功能的新名称。
谁能解释一下如何创建一个全新的功能来控制一些自定义功能?
我正在使用ASP.NET MVC(最新版本).
想象一下有两页:
第1页:"输入数据">>第2页:"谢谢"
提交Page-1后,您将被重定向到Page-2.
我的目标:当你进入Page-2后,当你点击浏览器的后退按钮时,我想确保你不能回到Page-1.相反,我希望你留在Page-2(或每次按下后退按钮时被推到Page-2).
我尝试过各种各样的事情.以下只是一些简化的伪代码......
[NoBrowserCache]
public ActionResult Page1(int userId)
{
var user = GetUserFromDb(userId);
if (user.HasAlreadySubmittedPage1InThePast)
{
// forward to page 2
return RedirectToAction("Page2", routeValues: new { userId = userId });
}
var model = new Page1Model();
return View("Page1", model);
}
[NoBrowserCache]
[HttpPost]
public ActionResult Page1(Page1Model model)
{
var user = GetUserFromDb(model.UserId);
if (user.HasAlreadySubmittedPage1InThePast)
{
// forward to page 2
return RedirectToAction("Page2", routeValues: new { userId = model.UserId });
}
// Save posted data to the …Run Code Online (Sandbox Code Playgroud) 我想在文本太长时隐藏文本,并在将鼠标悬停在文本上时显示它。
问题是当文本没有溢出时它也会触发。如何添加条件“如果文本溢出则执行翻译,如果文本没有溢出则不执行翻译”?
如果可能的话,我更喜欢css解决方案而不是javascript解决方案,以避免不必要的复杂性(每次有文本时我都需要使用它)。
PS:解决方案可以是scss标记。
.case {
cursor: pointer;
display: flex;
width: 10em;
height: 3em;
overflow: hidden;
background-color: #444444;
color: white;
margin-top: 2em;
margin-bottom: 2em;
flex-direction: row;
align-items: center;
}
.sp {
width: 100%;
height: auto;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
display: block;
}
.case:hover .sp {
transition: 1.3s;
overflow: inherit;
margin-left: -100%;
width: auto;
text-overflow: inherit;
transition-timing-function: linear;
}Run Code Online (Sandbox Code Playgroud)
<div class="case">
<span class="sp">Short text</span>
</div>
<div class="case">
<span …Run Code Online (Sandbox Code Playgroud)当我将.sidebar宽度设置为 100% 时,它会比以前变小。
然而,当我移除 bodyfont-size: 1.3rem并切换.sidebars时width: 100%,它会变得稍微大一些。
我知道当我们将 font-size 设置为 1.3rem 时,.primary-content的水平宽度(如果不换行)仍应与 的.sidebar宽度(如果不换行)具有相同的比例。
所以我不确定flexbox如何计算宽度:100%
body {
font-size: 1.3rem;
}
h1 {
margin-top: 0;
}
.container {
width: 80%;
max-width: 1100px;
margin: 0 auto;
}
.row {
display: flex;
}
.primary-content {
background-color: moccasin;
}
.sidebar {
/* width: 100%; */
padding: 1em;
text-align: center;
color: #fff;
background-color: #136c72;
}Run Code Online (Sandbox Code Playgroud)
<main class="main container row">
<section class="primary-content">
<h2>Quality designs made …Run Code Online (Sandbox Code Playgroud)我想使用不同类型(浅色,黑色,半粗体)的Google字体。
这是Google字体的链接:https : //fonts.googleapis.com/css?family=Exo+2 : 300,400,600,900
常规工作正常,font-family: 'Exo 2';但是我想知道如何使用浅色,黑色的。我尝试了Exo 2 Black / Light,但似乎没有用。
我也阅读了文档,但是也没有答案。
这个 CSS hack 曾经适用于 iOS 15.6,但在 iOS 16 中不起作用。
@media not all and (min-resolution:.001dpcm) {
@supports (-webkit-appearance:none) {}
}
Run Code Online (Sandbox Code Playgroud)
有没有针对 Safari 16 的新黑客?
有谁知道如何使用 CSS 和 HTML 制作这样的东西?

我自己尝试了一下,但看起来像这样:

这是我到目前为止所拥有的:
a {
text-decoration: none;
}
.bar {
background: #0f0f0f;
color: white;
border: 1px solid white;
border-radius: 5px;
padding: 25px;
display: grid;
grid-gap: 10px;
grid-template-columns: repeat(2, 1fr);
}
.icon {
font-size: x-large;
text-align: center;
width: 25%;
}
.text {
width: 100%;
}Run Code Online (Sandbox Code Playgroud)
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css" rel="stylesheet"/>
<div>
<a href="https://example.com" target="_blank">
<div class="bar">
<div class="icon"><i class="fas fa-folder"></i></div>
<div class="text"><b>Title</b><br>Description.</div>
</div>
</a>
</div>Run Code Online (Sandbox Code Playgroud)
css ×5
html ×3
asp.net ×1
asp.net-mvc ×1
capability ×1
flexbox ×1
fonts ×1
ios16 ×1
user-roles ×1
wordpress ×1