Inhaltsverzeichnis
回复讨论(解决方案)
Heim Web-Frontend HTML-Tutorial css格式问题_html/css_WEB-ITnose

css格式问题_html/css_WEB-ITnose

Jun 21, 2016 am 09:20 AM

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">#class3{	width:900px;	margin-left:auto;	margin-right:auto;	position:relative;	background-color:#099;	margin-top:150px;	}#class3 ul{	width:800px;	height:30px;	background-color:#936;	margin-left:auto;	margin-right:auto;	position:relative;	}	#class3 li{	list-style-type: none;	width: 100px;	position:relative;	margin-top:10px;	float:left;	background-color:#3F0;	margin-right:10px;	text-align:center;	}	#class2{	width:900px;	margin-left:auto;	margin-right:auto;	position:relative;	background-color:#099;	height:50px;	}			#class2 li .01{	list-style-type: none;	position: absolute;	left: 670px;	top: 23px;}	.02{	list-style-type: none;	position: absolute;	left: 365px;	top: 30px;}.03{	list-style-type: none;	position: absolute;	left: 308px;	top: 30px;}.04{	list-style-type: none;	position: absolute;	left: -232px;	top: 30px;	}	.05{	list-style-type: none;	position: absolute;	left: 201px;	top: 30px;}.06{	list-style-type: none;	position: absolute;	left: 252px;	top: 30px;}.07{	list-style-type: none;	position: absolute;	left: -97px;	top: 28px;}</style></head><body><div id="class2"><ul><li class="01">横排</li><li class="02">横排</li><li class="03">横排</li><li class="04">横排</li><li class="05">横排</li><li class="06">横排</li><li class="07">横排</li></ul></div><div id="class3"><ul><li>横排</li><li>横排</li><li>横排</li><li>横排</li><li>横排</li><li>横排</li><li>横排</li></ul></div></body></html>
Nach dem Login kopieren


.07{	list-style-type: none;	position: absolute;	left: -97px;	top: 28px;}
Nach dem Login kopieren

IE8浏览器为什么设置了类中的位置会无效,还是原来那样

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">#box06 {    position:relative;    width: 500px;    height: 100px;  top:50%;  left:50%;  margin-left:-250px;  margin-top:-50px;    background-color:#F39;}  #box07 {    position:absolute;    width: 300px;    height: 30px;    background-color:#0F0;    left:50%;  top:50%;  margin-left:-150px;  margin-top:-15px;}  #box08 {    position:absolute;    width: 300px;    height: 30px;    background-color:#0Ff;    left:30px;  top:50%;}.nav{	width:500px;	background-color:#000;}.nav li{width:80px;float:left;list-style:none;display:inline;background:#0F0;text-align:center;margin-right:10px;}</style></head><body><div class="nav"><ul><li>横排</li><li>横排</li><li>横排</li></ul></div><div> DIV1 </div><div> DIV2 </div><div style= "display:inline "> DIV1 </div><div style= "display:inline "> DIV2 </div><span>DIVCSS!</span> <span>DIVCSS5 </span> <span style= "display:block "> SPAN1 </span><span style= "display:block "> SPAN2 </span><div id="box06">  <div id="box07">box07</div>  <div id="box08">box08</div></div></body></html>
Nach dem Login kopieren


.nav{	width:500px;	background-color:#000;}
Nach dem Login kopieren


2、为什么类nav的这个黑色背景色出不来?


回复讨论(解决方案)

1class不要数字开头
2清除float

<div class="nav"><ul><li>横排</li><li>横排</li><li>横排</li> </ul>  <div style="clear:both;"></div></div> 
Nach dem Login kopieren

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">#class3{	width:900px;	margin-left:auto;	margin-right:auto;	position:relative;	background-color:#099;	margin-top:150px;	}#class3 ul{	width:800px;	height:30px;	background-color:#936;	margin-left:auto;	margin-right:auto;	position:relative;	}	#class3 li{	list-style-type: none;	width: 100px;	position:relative;	margin-top:10px;	float:left;	background-color:#3F0;	margin-right:10px;	text-align:center;	}	#class2{	width:100px;	margin-left:auto;	margin-right:auto;	position:relative;	background-color:#099;	height:50px;	}			#class2 .c01{	list-style-type: none;	position: absolute;	left: 422px;	top: 15px;	width: 60px;}	.c02{	list-style-type: none;	position: absolute;	left: 365px;	top: 15px;	width: 60px;}.c03{	list-style-type: none;	position: absolute;	left: 82px;	bottom: 0px;	right: 99px;	top: 15px;	height: 31px;	width: 58px;	top: 15px;}.c04{	list-style-type: none;	position: absolute;	left: -232px;	top: 30px;	top: 15px;	}	.c05{	list-style-type: none;	position: absolute;	left: 162px;	top: 15px;	width: 60px;	height: 32px;}.c06{	list-style-type: none;	position: absolute;	left: 252px;	top: 15px;	width: 60px;}.c07{	list-style-type: none;	position: absolute;	left: -97px;	top: 15px;	width: 60px;}</style></head><body><div id="class2"><ul><li class="c01">横1排</li><li class="c02">横2排</li><li class="c03">横3排</li><li class="c04">横4排</li><li class="c05">横5排</li><li class="c06">横6排</li><li class="c07">横7排</li></ul></div><div id="class3"><ul><li>横排</li><li>横排</li><li>横排</li><li>横排</li><li>横排</li><li>横排</li><li>横排</li></ul></div></body></html>
Nach dem Login kopieren

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">#box06 {    position:relative;    width: 500px;    height: 100px;  top:50%;  left:50%;  margin-left:-250px;  margin-top:-50px;    background-color:#F39;}  #box07 {    position:absolute;    width: 300px;    height: 30px;    background-color:#0F0;    left:50%;  top:50%;  margin-left:-150px;  margin-top:-15px;}  #box08 {    position:absolute;    width: 300px;    height: 30px;    background-color:#0Ff;    left:30px;  top:50%;}.nav{	width:500px;	background-color:#000;}.nav li{width:80px;float:left;list-style:none;display:inline;background:#0F0;text-align:center;margin-right:10px;}</style></head><body><div class="nav"><ul><li>横排</li><li>横排</li><li>横排</li></ul> <div style="clear:both;"></div></div><div> DIV1 </div><div> DIV2 </div><div style= "display:inline "> DIV1 </div><div style= "display:inline "> DIV2 </div><span>DIVCSS!</span> <span>DIVCSS5 </span> <span style= "display:block "> SPAN1 </span><span style= "display:block "> SPAN2 </span><div id="box06">  <div id="box07">box07</div>  <div id="box08">box08</div></div></body></html>
Nach dem Login kopieren

Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn

Heiße KI -Werkzeuge

Undresser.AI Undress

Undresser.AI Undress

KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover

AI Clothes Remover

Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool

Undress AI Tool

Ausziehbilder kostenlos

Clothoff.io

Clothoff.io

KI-Kleiderentferner

Video Face Swap

Video Face Swap

Tauschen Sie Gesichter in jedem Video mühelos mit unserem völlig kostenlosen KI-Gesichtstausch-Tool aus!

Heiße Werkzeuge

Notepad++7.3.1

Notepad++7.3.1

Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version

SublimeText3 chinesische Version

Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1

Senden Sie Studio 13.0.1

Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6

Dreamweaver CS6

Visuelle Webentwicklungstools

SublimeText3 Mac-Version

SublimeText3 Mac-Version

Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

Ist HTML für Anfänger leicht zu lernen? Ist HTML für Anfänger leicht zu lernen? Apr 07, 2025 am 12:11 AM

HTML ist für Anfänger geeignet, da es einfach und leicht zu lernen ist und schnell Ergebnisse sehen kann. 1) Die Lernkurve von HTML ist glatt und leicht zu beginnen. 2) Beherrschen Sie einfach die grundlegenden Tags, um Webseiten zu erstellen. 3) hohe Flexibilität und kann in Kombination mit CSS und JavaScript verwendet werden. 4) Reiche Lernressourcen und moderne Tools unterstützen den Lernprozess.

Die Rollen von HTML, CSS und JavaScript: Kernverantwortung Die Rollen von HTML, CSS und JavaScript: Kernverantwortung Apr 08, 2025 pm 07:05 PM

HTML definiert die Webstruktur, CSS ist für Stil und Layout verantwortlich, und JavaScript ergibt eine dynamische Interaktion. Die drei erfüllen ihre Aufgaben in der Webentwicklung und erstellen gemeinsam eine farbenfrohe Website.

Was ist ein Beispiel für ein Start -Tag in HTML? Was ist ein Beispiel für ein Start -Tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofaTartingTaginHtmlis, die, die starttagsaresesinginhtmlastheyinitiateElements, definetheirtypes, andarecrucialForstructuringwebpages und -konstruktionsthedoms.

HTML, CSS und JavaScript verstehen: Ein Anfängerhandbuch HTML, CSS und JavaScript verstehen: Ein Anfängerhandbuch Apr 12, 2025 am 12:02 AM

WebdevelopmentRelieSonHtml, CSS und JavaScript: 1) HtmlStructuresContent, 2) CSSstylesit und 3) JavaScriptaddssinteraktivität, Bildung von TheBasisofModerernwebexperiences.

Wie kann man adaptives Layout der Y-Achse-Position in Webanmerkungen implementieren? Wie kann man adaptives Layout der Y-Achse-Position in Webanmerkungen implementieren? Apr 04, 2025 pm 11:30 PM

Der ad-axis-Position adaptive Algorithmus für Webanmerkungen In diesem Artikel wird untersucht, wie Annotationsfunktionen ähnlich wie Word-Dokumente implementiert werden, insbesondere wie man mit dem Intervall zwischen Anmerkungen umgeht ...

Gitee Pages statische Website -Bereitstellung fehlgeschlagen: Wie können Sie einzelne Dateien 404 Fehler beheben und beheben? Gitee Pages statische Website -Bereitstellung fehlgeschlagen: Wie können Sie einzelne Dateien 404 Fehler beheben und beheben? Apr 04, 2025 pm 11:54 PM

GitePages statische Website -Bereitstellung fehlgeschlagen: 404 Fehlerbehebung und Auflösung bei der Verwendung von Gitee ...

HTML, CSS und JavaScript: Wesentliche Tools für Webentwickler HTML, CSS und JavaScript: Wesentliche Tools für Webentwickler Apr 09, 2025 am 12:12 AM

HTML, CSS und JavaScript sind die drei Säulen der Webentwicklung. 1. HTML definiert die Webseitenstruktur und verwendet Tags wie z.

Wie verwendet ich CSS3 und JavaScript, um den Effekt der Streuung und Vergrößerung der umgebenden Bilder nach dem Klicken zu erreichen? Wie verwendet ich CSS3 und JavaScript, um den Effekt der Streuung und Vergrößerung der umgebenden Bilder nach dem Klicken zu erreichen? Apr 05, 2025 am 06:15 AM

Um den Effekt der Streuung und Vergrößerung der umgebenden Bilder nach dem Klicken auf das Bild zu erreichen, müssen viele Webdesigns einen interaktiven Effekt erzielen: Klicken Sie auf ein bestimmtes Bild, um die Umgebung zu machen ...

See all articles