我相信对于那些比我聪明的人来说,这可能很简单。我的问题是我想将圆圈置于页面中间,但仍然保持每个圆圈的轻微重叠。我尝试的所有东西似乎都将圆圈分开,我失去了重叠。我已经尝试更改.ca菜单,但我尝试的似乎不起作用。我为所有代码道歉,但不知道怎么做而不粘贴它。我想确保我有可能需要的一切来帮助找到问题/解决方案。
body {
background-color: #000;
font-family: 'Baskerville', 'Palatino Linotype', 'Palatino', 'Century Schoolbook L', 'Times New Roman', 'serif'
}
.homepage {
background-image: url(pagepics/big_oscar.png), url(pagepics/emmy.png);
background-position: left, right;
background-repeat: no-repeat;
background-size: 220px, 220px;
padding: 250px;
}
h2 {
font-size: 30px;
color: #4BFC03;
text-align: center;
}
h3 {
font-size: 27.5px;
color: #d4af37;
}
#header1 {
width: 1220px;
margin: 0 auto;
height: 125px;
background-image: url(pagepics/oscars-banner3.jpg);
}
#header2 {
width: 1100px;
margin: 0 auto;
height: 100px;
background-image: url(pagepics/emmybanner.png);
}
.indent {
text-indent: 50px;
}
.link1 {
color: orangered;
text-align: center;
}
#footer {
background-color: #000;
color: turquoise;
text-align: center;
height: 60px;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
#footer1 {
color: turquoise;
text-align: center;
}
img.floatLeft {
float: left;
margin: 5px;
}
#centerText1 {
text-align: center;
color: red;
}
li h3 {
margin: .1px 0;
}
article {
position: relative;
z-index: 1;
}
.article:before {
content: " ";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: .3;
z-index: -1;
background: url(pagepics/emmy.png);
}
.ca-menu {
padding: 0;
margin: 50px auto;
width: 140px;
display: inline-block;
}
.ca-menu li {
width: 150px;
height: 150px;
border: 10px solid orangered;
overflow: hidden;
position: relative;
float: left;
background: #005B8E;
margin-right: 10px;
box-shadow: 5px 5px 2px rgba(0, 0, 0, 0.2);
border-radius: 125px;
transition: all 400ms linear;
}
.ca-menu li a {
text-align: left;
display: block;
width: 100%;
height: 100%;
color: #BEFC00;
position: relative;
}
.ca-icon {
font-size: 18px;
text-shadow: 0px 0px 10px #101254;
line-height: 135px;
position: static;
padding-left: 15px;
width: 50px;
left: 20px;
text-align: center;
transition: all 900ms linear;
}
.ca-content {
position: absolute;
left: 120px;
width: 370px;
height: 50px;
top: 20px;
}
.ca-menu li:hover {
background: #930016;
border-color: #4BFC03;
transform: rotate(360deg);
}
.ca-menu li:hover .ca-icon {
color: #BEFC00;
font-size: 18px;
}
.ca-menu li:hover .ca-main {
display: none;
}
.ca-menu li:hover .ca-sub {
opacity: 8.0;
}
<header>
<div id="header1"></div>
</header>
<ul class="ca-menu">
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Home Page</strong></span>
</a>
</li>
</ul>
<ul class="ca-menu">
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Oscar Trivia</strong></span>
</a>
</li>
</ul>
<ul class="ca-menu">
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Emmy Trivia</strong></span>
</a>
</li>
</ul>
<ul class="ca-menu">
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Oscar Winners</strong></span>
</a>
</li>
</ul>
<ul class="ca-menu">
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Emmy Winners</strong></span>
</a>
</li>
</ul>
<main>
<p>
<h2>Why Are the Academy Awards Statuettes Called "Oscars"?</h2>
<article>
<h3 class="indent">blah blah</h3>
<h3 class="indent">blah blah</h3>
<h3 class="indent">blah blah</h3>
<h3 class="indent">blah blah</h3>
</article>
</main>
<aside>
<h2>Statistics</h2>
<ul style="list-style-type:none">
<li>
<h3>blah blah</h3>
</li>
</ul>
</aside>
<footer>
<h5 class id="footer1">© BPA Productions 2018</h5>
</footer>
答案 0 :(得分:2)
只需将它们包装在一个容器中,您可以在其中应用text-align:center
:
body {
background-color: #000;
font-family: 'Baskerville', 'Palatino Linotype', 'Palatino', 'Century Schoolbook L', 'Times New Roman', 'serif'
}
.homepage {
background-image: url(pagepics/big_oscar.png), url(pagepics/emmy.png);
background-position: left, right;
background-repeat: no-repeat;
background-size: 220px, 220px;
padding: 250px;
}
h2 {
font-size: 30px;
color: #4BFC03;
text-align: center;
}
h3 {
font-size: 27.5px;
color: #d4af37;
}
#header1 {
width: 1220px;
margin: 0 auto;
height: 125px;
background-image: url(pagepics/oscars-banner3.jpg);
}
#header2 {
width: 1100px;
margin: 0 auto;
height: 100px;
background-image: url(pagepics/emmybanner.png);
}
.indent {
text-indent: 50px;
}
.link1 {
color: orangered;
text-align: center;
}
#footer {
background-color: #000;
color: turquoise;
text-align: center;
height: 60px;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
#footer1 {
color: turquoise;
text-align: center;
}
img.floatLeft {
float: left;
margin: 5px;
}
#centerText1 {
text-align: center;
color: red;
}
li h3 {
margin: .1px 0;
}
article {
position: relative;
z-index: 1;
}
.article:before {
content: " ";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: .3;
z-index: -1;
background: url(pagepics/emmy.png);
}
.menu-container {
text-align:center;
}
.ca-menu {
padding: 0;
margin: 50px auto;
display: inline-block;
width:140px;
}
.ca-menu li {
width: 150px;
height: 150px;
border: 10px solid orangered;
overflow: hidden;
position: relative;
float: left;
background: #005B8E;
margin-right: 10px;
box-shadow: 5px 5px 2px rgba(0, 0, 0, 0.2);
border-radius: 125px;
transition: all 400ms linear;
}
.ca-menu li a {
text-align: left;
display: block;
width: 100%;
height: 100%;
color: #BEFC00;
position: relative;
}
.ca-icon {
font-size: 18px;
text-shadow: 0px 0px 10px #101254;
line-height: 135px;
position: static;
padding-left: 15px;
width: 50px;
left: 20px;
text-align: center;
transition: all 900ms linear;
}
.ca-content {
position: absolute;
left: 120px;
width: 370px;
height: 50px;
top: 20px;
}
.ca-menu li:hover {
background: #930016;
border-color: #4BFC03;
transform: rotate(360deg);
}
.ca-menu li:hover .ca-icon {
color: #BEFC00;
font-size: 18px;
}
.ca-menu li:hover .ca-main {
display: none;
}
.ca-menu li:hover .ca-sub {
opacity: 8.0;
}
&#13;
<header>
<div id="header1"></div>
</header>
<div class="menu-container">
<ul class="ca-menu">
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Home Page</strong></span>
</a>
</li>
</ul>
<ul class="ca-menu">
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Oscar Trivia</strong></span>
</a>
</li>
</ul>
<ul class="ca-menu">
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Emmy Trivia</strong></span>
</a>
</li>
</ul>
<ul class="ca-menu">
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Oscar Winners</strong></span>
</a>
</li>
</ul>
<ul class="ca-menu">
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Emmy Winners</strong></span>
</a>
</li>
</ul>
</div>
<main>
<p>
<h2>Why Are the Academy Awards Statuettes Called "Oscars"?</h2>
<article>
<h3 class="indent">blah blah</h3>
<h3 class="indent">blah blah</h3>
<h3 class="indent">blah blah</h3>
<h3 class="indent">blah blah</h3>
</article>
</main>
<aside>
<h2>Statistics</h2>
<ul style="list-style-type:none">
<li>
<h3>blah blah</h3>
</li>
</ul>
</aside>
<footer>
<h5 class id="footer1">© BPA Productions 2018</h5>
</footer>
&#13;
答案 1 :(得分:2)
稍微编辑了你的HTML代码,所以它会更好。在CSS中,类.ca-menu
添加了display: flex;
和justify-content: center;
进行中心对齐。
body {
background-color: #000;
font-family:'Baskerville', 'Palatino Linotype', 'Palatino', 'Century Schoolbook L', 'Times New Roman', 'serif'
}
.homepage {
background-image: url(pagepics/big_oscar.png), url(pagepics/emmy.png);
background-position: left, right;
background-repeat: no-repeat;
background-size: 220px, 220px;
padding: 250px;
}
h2 {
font-size: 30px;
color: #4BFC03;
text-align: center;
}
h3 {
font-size: 27.5px;
color: #d4af37;
}
#header1{
width:1220px;
margin: 0 auto;
height:125px;
background-image:url(pagepics/oscars-banner3.jpg);
}
#header2{
width:1100px;
margin: 0 auto;
height:100px;
background-image:url(pagepics/emmybanner.png);
}
.indent {
text-indent: 50px;
}
.link1 {
color: orangered;
text-align: center;
}
#footer {
background-color: #000;
color: turquoise;
text-align: center;
height: 60px;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
#footer1 {
color: turquoise;
text-align: center;
}
img.floatLeft {
float:left;
margin:5px;
}
#centerText1 {
text-align: center;
color: red;
}
li h3 {
margin: .1px 0;
}
article {
position: relative;
z-index: 1;
}
.article:before {
content: " ";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: .3;
z-index: -1;
background: url(pagepics/emmy.png);
}
.ca-menu {
padding: 0;
margin: 50px auto;
display: flex;
justify-content: center;
}
.ca-menu li{
width: 150px;
height: 150px;
border: 10px solid orangered;
overflow: hidden;
position: relative;
float:left;
background: #005B8E;
margin-right: -26px;
box-shadow: 5px 5px 2px rgba(0,0,0,0.2);
border-radius: 125px;
transition: all 400ms linear;
}
.ca-menu li a{
text-align: left;
display: block;
width: 100%;
height: 100%;
color: #BEFC00;
position:relative;
}
.ca-icon{
font-size: 18px;
text-shadow: 0px 0px 10px #101254;
line-height: 135px;
position: static;
padding-left: 15px;
width: 50px;
left: 20px;
text-align: center;
transition: all 900ms linear;
}
.ca-content {
position: absolute;
left: 120px;
width: 370px;
height: 50px;
top: 20px;
}
.ca-menu li:hover{
background: #930016;
border-color: #4BFC03;
transform: rotate(360deg);
}
.ca-menu li:hover .ca-icon{
color: #BEFC00;
font-size: 18px;
}
.ca-menu li:hover .ca-main{
display: none;
}
.ca-menu li:hover .ca-sub{
opacity: 8.0;
}
&#13;
<header>
<div id="header1"></div>
</header>
<ul class="ca-menu">
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Home Page</strong></span>
</a>
</li>
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Oscar Trivia</strong></span>
</a>
</li>
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Emmy Trivia</strong></span>
</a>
</li>
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Oscar Winners</strong></span>
</a>
</li>
<li>
<a href="OscarTrivia.html" target="_blank">
<span class="ca-icon"><strong>Emmy Winners</strong></span>
</a>
</li>
</ul>
<main><p>
<h2>Why Are the Academy Awards Statuettes Called "Oscars"?</h2>
<article><h3 class="indent">blah blah</h3>
<h3 class="indent">blah blah</h3>
<h3 class="indent">blah blah</h3>
<h3 class="indent">blah blah</h3></article>
</main>
<aside>
<h2>Statistics</h2>
<ul style="list-style-type:none">
<li><h3>blah blah</h3></li>
</ul>
</aside>
<footer>
<h5 class id="footer1">© BPA Productions 2018</h5>
</footer>
&#13;