gpt4 book ai didi

HTML5 CSS3 布局不工作

转载 作者:太空宇宙 更新时间:2023-11-03 20:02:26 25 4
gpt4 key购买 nike

根据以下答案进行大规模编辑

原始帖子在这里 http://webmasters.stackexchange.com在 miration 之前。

我终于让页面在所有浏览器(所有主要浏览器;Chrome、Opera、Safari、Firefox)上都能正常布局,IE 9 及其遗留版本除外。目前,链接在第二个链接(具有下拉菜单)之后停止显示在“导航”栏中。这些链接对于下拉菜单都是水平安全的,直到它到达第三个链接并且它们都显示在“导航”栏下方并作为垂直列表。我确定问题需要一个单独的 IE 样式表,但问题是主样式表或菜单样式表,目的是什么?

这是布局的图片:

hereHTML5 -核心布局-

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>College Of Martial Arts</title>
<link href="menu.css" rel="stylesheet" type="text/css">
<link href="master.css" rel="stylesheet" type="text/css"><!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>

<body>

<div class="wrap">
<div id="logo" class="logo"><img src="images/comalogo.png" width="100" height="150"></div>
<header>
<p> College Of Martial Arts</p>
</header>

<!-- This is the HTML for the navigation bar at the top of the website -->
<nav>
<ul id="menu"><b>
<li><a href="#">News</a></li>
<li>·</li>
<li><a href="#">About Us</a>
<ul>
<li><a href="#">The Instructors</a></li>
<li><a href="#">Our Arts</a></li>

</ul>
</li>
<li>·</li>
<li><a href="#">Location</a></li>
<li>·</li>
<li><a href="#">Gallery</a></li>
<li>·</li>
<li><a href="#">MMA.tv</a></li>
<li>·</li>
<li><a href="#">Schedule</a></li>
<li>·</li>
<li><a href="#">Fight Gear</a></li></b>
</ul>
</nav>

<!-- end nav -->

<div class="midwrap">
<div class="sidebar1">
<aside>

<p>This is an area for module/blocks for various uses such as; upcoming events, shout box, mini calendar and many more possibilities.</p>
</aside>
<!-- end .sidebar1 --></div>
<article class="content">
<h1>Main Content Area</h1>
<section>
<h2>A place to post content</h2>
<p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"

<a href="http://www.lipsum.com/">http://www.lipsum.com/</a>.</p>
</section>
<div class="clearfooter"></div>
<!-- end .content --></article></div>
<footer>
<p>This footer contains the declaration position:relative; to give Internet Explorer 6 hasLayout for the footer and cause it to clear correctly. If you're not required to support IE6, you may remove it.</p>
<address>
Address Content
</address>
</footer>
<!-- end .wrap --></div>
</body>
</html>

CSS3-菜单样式表

@charset "utf-8";
/* CSS Document */

/* Main */
#menu
{
width: 100%;
margin: 0;
padding: 10px 0 0 0;
list-style: none;
background: url(images/menubg.png) repeat-x;
background: -moz-linear-gradient(#000, #333);
background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #444),color-stop(1, #000));
background: -webkit-linear-gradient(#000, #333);
background: -o-linear-gradient(#000, #333);
background: -ms-linear-gradient(#000, #333);
background: linear-gradient(#000, #333);
-moz-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: 0 2px 1px #9c9c9c;
-webkit-box-shadow: 0 2px 1px #9c9c9c;
box-shadow: 0 8px 8px #9c9c9c;
/* outline:#000 solid thin; */



}

#menu li
{
left:150px;
float: left;
padding: 0 0 10px 0;
position:relative;
color: #FC0;
font-size:15px;
font-family:'freshman' cursive;
line-height:15px;
display: inline-block;
}


#menu a
{
float: left;
height: 15px;
line-height:15px;
padding: 0 10px;
color: #FC0;
font-size:15px;
text-decoration: none;
text-shadow: 1 1px 0 #000;
text-align:center;
}


#menu li:hover > a
{
color: #fafafa;
}


*html #menu li a:hover /* IE6 */
{
color: #fafafa;
}


#menu li:hover > ul
{
display: block;
}


/* Sub-menu */
#menu ul
{
list-style: none;
margin: 0;
padding: 0;
display: none;
position: absolute;
top: 25px;
left: 0;
z-index: 99999;
background: url(images/menubg.png) repeat-x;
background: -moz-linear-gradient(#000, #333);
background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));
background: -webkit-linear-gradient(#000, #333);
background: -o-linear-gradient(#000, #333);
background: -ms-linear-gradient(#000, #333);
background: linear-gradient(#000, #333);
-moz-border-radius: 5px;
border-radius: 5px;
/* outline:#000 solid thin; */
}


#menu ul li
{
left:0;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}


#menu ul a
{
padding: 10px;
height: auto;
line-height: 1;
display: block;
white-space: nowrap;
float: none;
text-transform: none;
}


*html #menu ul a /* IE6 */
{
height: 10px;
width: 200px;
}


*:first-child+html #menu ul a /* IE7 */
{
height: 10px;
width: 200px;
}


/* Clear floated elements */
#menu:after
{
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}


* html #menu { zoom: 1; } /* IE6 */
*:first-child+html #menu { zoom: 1; } /* IE7 */

CSS3 - 主样式表 -

@charset "utf-8";

*{
margin: 0;
padding: 0;
}

html{
height:100%;
}

body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background: #000;
margin: 0;
padding: 0;
color: #000;
}

/* ~~ Element/tag selectors ~~ */
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing block. The remaining bottom margin will hold it away from any elements that follow. */
padding-right: 15px;
padding-left: 15px; /* adding the padding to the sides of the elements within the blocks, instead of the block elements themselves, gets rid of any box model math. A nested block with side padding can also be used as an alternate method. */
}
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
border: none;
}
/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
a:link {
color: #FC0;
text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
}
a:visited {
color: #FC0;
text-decoration: underline;
}
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
text-decoration: none;
}
/* ~~ This fixed width container surrounds all other blocks ~~ */
.wrap {
position: relative;
width: 1250px;
min-height: 100%;
margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
color: #fff;
}

div.logo{
position: absolute;
top: 25px;
left: 20px;
}


header {
background-color: #999;
color: #FC0;
margin-left: 5px;
height: 80px;
width: 1240px;
line-height: 70px;
font-family: 'freshman' cursive;
font-size: 50px;
text-shadow: 8px 8px #9c9c9c;
text-outline: 1px 1px #000;
text-align: center;
}

/* ~~ These are the columns for the layout. ~~

1) Padding is only placed on the top and/or bottom of the block elements. The elements within these blocks have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the block itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the block element and place a second block element within it with no width and the padding necessary for your design.

2) No margin has been given to the columns since they are all floated. If you must add margin, avoid placing it on the side you're floating toward (for example: a right margin on a block set to float right). Many times, padding can be used instead. For blocks where this rule must be broken, you should add a "display:inline" declaration to the block element's rule to tame a bug where some versions of Internet Explorer double the margin.

3) Since classes can be used multiple times in a document (and an element can also have multiple classes applied), the columns have been assigned class names instead of IDs. For example, two sidebar blocks could be stacked if necessary. These can very easily be changed to IDs if that's your preference, as long as you'll only be using them once per document.

4) If you prefer your nav on the left instead of the right, simply float these columns the opposite direction (all left instead of all right) and they'll render in reverse order. There's no need to move the blocks around in the HTML source.

*/
.midwrap{
float: left;
background-color: #999;
margin-left: 5px;
width: 1240px;
color: #FFF;

}

.sidebar1 {
float: right;
width: 250px;
background: #999;
padding: 10px 0px 0px 10px;
}

.content {
padding: 10px 0;
width: 850px;
float: right;
background:#999;
}

/* ~~ This grouped selector gives the lists in the .content area space ~~ */
.content ul, .content ol {
padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
}

.clearfooter {
height: 330px;
}

/* ~~ The footer ~~ */
footer {
margin-left:5px;
height: 330px;
width:1240px;
padding: 10px 0;
background: #69F;
bottom: 0;
position: relitive;/* this gives IE6 hasLayout to properly clear */
clear: both; /* this clear property forces the .container to understand where the columns end and contain them */
}

/*HTML 5 support - Sets new HTML 5 tags to display:block so browsers know how to render the tags properly. */
header, section, footer, aside, nav, article, figure {
display: block;
}

最佳答案

</li></ul><li>Our Arts</li> 之后被交换这使 CSS 消失了。为了更好地衡量,在 CSS 中使用 display: inline-block;对于 #menu ul {}#menu li {} .

关于HTML5 CSS3 布局不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10864369/

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