【问题标题】:HTML action using ASP.net使用 ASP.net 的 HTML 动作
【发布时间】:2025-12-14 02:15:01
【问题描述】:

该链接工作正常,但 CSS 的行为不符合应有的方式。 HTML Only 一个完美地工作。我认为问题在于它停留在按钮后面的跨度。

按钮的行为应该像这里:

http://www.htmldrive.net/items/demo/1832/Pure-CSS3-Animated-buttons

<li><div class="drag-item" draggable="true">
@Html.ActionLink("Sales", "Sales", "Home",  new { @class = "round" }, new { @class = "round yellow" })<span>Tender Sales - Customer Balances etc</span>

这个很完美

  <li><div class="drag-item" draggable="true"><a href="/finance" class="round red">Finance<span class="round">Tender Sales - Customer Balances etc</span></a></li>

【问题讨论】:

  • 如果它在硬编码为 HTML 时完美运行,那么为什么不检查点击 Razor 视图的结果以查看它生成的 HTML - 然后进行比较?
  • 你渲染的 HTML 是什么样的?

标签: css asp.net


【解决方案1】:

你好,很抱歉我浪费了任何时间,谢谢。我找到了解决方案。在这里发给可能需要的人。

    <a href="@Url.Action("View", "Controller")" class="Css Classname">


     **<li><div class="drag-item" draggable="true"><a 
     href="@Url.Action("Welcome", "Helloworld")" class="round 
    yellow">Sales<span class="round" aria-hidden="true">Tender Sales - 
    Customer Balances etc</span></a></li>**

【讨论】: