html - html&css 中的笔记本便利贴样式菜单

标签 html css menu

我想创建一个像笔记本便利贴一样的菜单。看起来像这样: enter image description here

基本上想并排放置两个 div,让左边的 div 成为页面,右边的 div 成为菜单。如果页面高度增加,两个菜单元素之间的空间应该按比例扩大。我已经尝试了 2 天,代码是这样的:

 <div class="specific_recipeBook_withStickers">

    <div class="specific_recipeBook">
        <div class="specific_recipeBook_spiral"></div>
        <div class="specific_recipeBook_main">

            <ul class="specific_recipeBook_list">
                <li class="specific_recipeBook_list_unit">
                    <div class="specific_recipeBook_main_lines"></div>

                    <a class="specific_resipeBook_list_unit_text" ><h4 id="specific_resipeBook_list_unit_name">Kuru Fasulye</h4>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi u</a>
                </li>
            </ul>
        </div>

    </div>
    <div class="specific_recipebook_stickers">
        <div class="specific_recipeBook_sticker" id="recipeBook_stickers_1" ><a class="specific_recipeBook_stickers_text">Salata</a>  </div>
        <div class="specific_recipeBook_sticker" id="recipeBook_stickers_2" ><a class="specific_recipeBook_stickers_text">Tatlı</a></div>
        <div class="specific_recipeBook_sticker" id="recipeBook_stickers_3" ><a class="specific_recipeBook_stickers_text">Yan Yemek </a></div>
        <div class="specific_recipeBook_sticker" id="recipeBook_stickers_4" ><a class="specific_recipeBook_stickers_text">Anayemek  </a></div>
    </div>
</div>

JSFiddle

但是效果不是很好。我应该用什么方式来做?

最佳答案

使用类似这个函数的东西

$(document).ready(function ($) {

    $(".specific_recipeBook").each(function(j,d) {
        var maxHeight = 0;
        maxHeight = $(d).height();
        var ratioedHeight = maxHeight*0.08;
        console.log(maxHeight);
        document.getElementById("recipeBook_stickers_1").style.marginBottom = 3+ ratioedHeight+"px";
        document.getElementById("recipeBook_stickers_1").style.marginBottom = 3+ ratioedHeight+"px";
        document.getElementById("recipeBook_stickers_2").style.marginBottom = 3+ ratioedHeight+"px";
        document.getElementById("recipeBook_stickers_3").style.marginBottom = 3+ ratioedHeight+"px";
        document.getElementById("recipeBook_stickers_4").style.marginBottom = 3+ ratioedHeight+"px";
    });
});

关于html - html&css 中的笔记本便利贴样式菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35700504/

相关文章:

html - angular 2 在鼠标进入和离开时显示和隐藏组件

html - BeautifulSoup findall 与名称列表没有找到另一个目标之后的目标

javascript - 修复窗口调整大小时带有侧边栏位置的导航栏

javascript - 在 Firefox 中检测缩放

html - 如何在 asp.net web 表单中将 MultiView 与 TreeView 对齐?

CSS圆 Angular 问题

javascript - 将 Javascript 添加到向下箭头按钮以打开和关闭子菜单

html - 我如何调整文本周围边框的宽度?

html - 如何在 Bootstrap 中的导航项之间添加空间

html - 使用 CSS 增加水平菜单项之间的间距时遇到问题