gpt4 book ai didi

html - 如何应用 CSS 将标签中包裹的 DDA.AC 字符置于屏幕中央

转载 作者:太空宇宙 更新时间:2023-11-04 06:13:40 25 4
gpt4 key购买 nike

当网页变小时,我希望在中间显示 DDA.AC 文本。

text-align: center; for any tag it does not change. 

https://jsfiddle.net/4oz0yuf7/

最佳答案

当浏览器屏幕宽度较小时,您可以使用@media (max-width: 768px) 来设置css。这也是您的汉堡菜单出现时的宽度。

您还需要将.container 的宽度扩展到全宽,并关闭.navbar-brandfloat。当屏幕大于 768 像素时,所有这些设置将应用并恢复为默认值。

您可以尝试将其添加到您的 css 中:

 @media (max-width: 768px) {

.container {
width:100%;
}

a.navbar-brand {
display:block;
float:none;
}
}

.navbar-toggle{
float: left;
right: 40px;
}
.navbar-default .navbar-brand{
color: #f7ca02;
font-weight: 700;
font-size: 20px;
opacity: 1;
}
.navbar-default .navbar-brand:hover{
color: #f7ca02;
opacity: 1;
}
.navbar-brand{
text-align: center;
vertical-align: middle;
}
.navbar-nav>li>a{
padding-left: 25px;
transition: ease 0.5s;
}
.navbar-nav>li>a:hover {
opacity: 1;
}
.navbar-header{
align-items: center;
}
.navbar-default {
background-color: white;
border-top:2px solid #f7960e;
border-bottom-color: #77787a;
}
.navbar-fixed-top{
padding-top: 5px;
padding-bottom: 5px;
}
a{
opacity: 0.5;
}
#card{
color: #ef4721;
}
#login{
left: 55px;
}
.container{
margin-left: 19px;
display: inline-block;
text-align: center;
}
.jumbotron{

background-image: url('https://lh3.googleusercontent.com/JXo_Zcavc5c4RIULtbyHrV7fShbnNr1-o0jsafXcOgwK_XApi-310FFg9IelshlQExI=w720-h310-rw');
background-size: cover;
}

@media (max-width: 768px) {

.container {
width:100%;
}

a.navbar-brand {
display:block;
float:none;
}
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css">
<link rel="stylesheet" type="text/css" href="ddaac.css">
<title>DDA.AC</title>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">DDA.AC</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="#">컨텐츠</a></li>
<li><a href="#">덱리스트</a></li>
<li><a id="card" href="#">카드평가</a></li>
<li><a href="#">트위터</a></li>
<li><a href="#">게시판</a></li>
</ul>

<ul class="nav navbar-nav navbar-right">
<li><a id="login" href="#">로그인</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</div>
</nav>

<div class="jumbotron">

</div>


<script src="https://code.jquery.com/jquery-1.12.4.min.js" ></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" ></script>
</body>
</html>

关于html - 如何应用 CSS 将标签中包裹的 DDA.AC 字符置于屏幕中央,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56196151/

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