gpt4 book ai didi

div 框的 CSS 边距样式

转载 作者:太空宇宙 更新时间:2023-11-03 23:12:36 24 4
gpt4 key购买 nike

您好,我一直在使用 google chrome 中的开发工具来尝试向我的导航栏添加边距。预期的想法是留出边距,使我能够在框之间创建间隙。感谢您的帮助!

http://jsfiddle.net/3jp1d0fe/8/

CSS

div.container {
display: table;
display: table-row;
}
div.column {
display: table-cell;
vertical-align:middle;
text-align:center;
background-color:#c2ad80;
}
div.column a {
color:white;
font-family: Arial;
font-size: 12px;
text-decoration:none;
display:block;
height:100px;
width:100px;
display: table-cell;
vertical-align: middle;
}
div.column.current, div.column:hover {
background-color: #a2884f;
}

HTML

<div class="container">
<div class="column"><a href="/sites/SharePointSDLC/SitePages/Solution%20Assessment.aspx"> Solution Assessment</a></div>
<div class="column"><a href="/sites/SharePointSDLC/SitePages/Design.aspx"> Design</a></div>
<div class="column"><a href="/sites/SharePointSDLC/SitePages/Build.aspx"> Build</a></div>
<div class="column"><a href="/sites/SharePointSDLC/SitePages/Deploy.aspx"> Deploy</a></div>
<div class="column"><a href="/sites/SharePointSDLC/SitePages/Test.aspx"> Test</a></div>
<div class="column"><a href="/sites/SharePointSDLC/SitePages/Live.aspx"> Live (BAU)</a></div>
</div>

JS

$(function () {
url = location.pathname.substr(1);
$('a[href*="' + url + '"]').closest(".column").addClass("current");
});

$(".column a").click(function () {
$(".current").removeClass("current");
$(this).closest(".column").addClass("current");
return false;
});

最佳答案

试试这个可能对你有帮助..

$(function () {
url = location.pathname.substr(1);
$('a[href*="' + url + '"]').closest(".column").addClass("current");
});

$(".column a").click(function () {
$(".current").removeClass("current");
$(this).closest(".column").addClass("current");
return false;
});
div.container {
display: table;
border-collapse: separate;
border-spacing: 10px;
}
div.column {
display: table-cell;
border-spacing: 10px;
vertical-align:middle;
text-align:center;
background-color:#c2ad80;

}
div.row { display:table-row; }
div.column a {
color:white;
font-family: Arial;
font-size: 12px;
text-decoration:none;
display:block;
height:100px;
width:100px;
display: table-cell;
vertical-align: middle;

}
div.column.current, div.column:hover {
background-color: #a2884f;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body>
<div class="container">
<div class="row">
<div class="column"><a href="https://www.google.co.uk"> Solution Assessment</a>

</div>
<div class="column"><a href="https://www.google.co.uk"> Design</a>

</div>
<div class="column"><a href="https://www.google.co.uk"> Build</a>

</div>
<div class="column"><a href="https://www.google.co.uk"> Deploy</a>

</div>
<div class="column"><a href="https://www.google.co.uk"> Test</a>

</div>
<div class="column"><a href="https://www.google.co.uk"> Live (BAU)</a></div>
</div>
</div>
</body>

关于div 框的 CSS 边距样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32049101/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com