首页 > 解决方案 > 如何通过博客计数调整两个值之间的 HTML div/链接?

问题描述

我想使用 . 放大或缩小类别的标签框transform: scale(1.x)。例如;

A tag --> 8 blogs,
B tag --> 4 blogs,
C tag --> 3 blogs,
D tag --> 2 blogs,
E tag --> 0 blog

当有标签数的博客数一直是这样的时候,天平可以是这样的;

8 blogs--> 1.5,
4 blogs --> 1.4,
3 blogs --> 1.3
2 blogs --> 1.2,
0 blog --> 1.0




    @foreach (var item in Model.BlogTag)
                {
                    var tagCounts = Model.BlogTag.GroupBy(p=>p.BlogTagRelation).Select(p=>p.Key);
                    int tagCount = item.BlogTagRelation.Distinct().Count();
                    //0-5 arasında değişkenlik göstermeli!
                    int item_scale_by_count = 0;
                    if (tagCount > 1)
                    {
                        for (int i = 0; i < tagCounts.Count(); i++)
                        {

                        }
                    }

                    <a  style="transform:scale(1.@item_scale_by_count)" href="@item.Sitemap.Permalink" class="category_box__tag_link mr-2 mb-2">@item.Title (@tagCount)</a>
                }

但我想在 1.0 和 1.5 之间更改标签框比例。我怎样才能动态地做到这一点?

在此处输入图像描述

标签: asp.netasp.net-core

解决方案


推荐阅读