2015-11-05 33 views
-4

當我嘗試更改我的p和h1的字體系列和字體大小時,它不起作用。幫助將不勝感激。隨意指出我的代碼中的任何其他錯誤,因爲這是我長時間編碼的第一次。P和H1不起作用

html, body { margin: 0; padding: 0; } 
 

 
.navbackground { 
 
height: 55px; 
 
width: 100%; 
 
position: fixed; 
 
background-color: #FFFFFF; 
 
box-shadow: 0px 1px 5px #686868; 
 
} 
 
.navmenu-and-logo { 
 
height: 55px; 
 
width: 960px; 
 
position: fixed; 
 
left: 0; 
 
right: 95px; 
 
margin: 0 auto; 
 
} 
 
.logo { 
 
float:left; 
 
} 
 
.menu { 
 
float:right; 
 
} 
 
.navmenu-and-logo a { 
 
padding: 17px 15px 0px 15px; 
 
color: #45ACFF; 
 
text-decoration:none; 
 
height: 38px; 
 
display: block; 
 
} 
 
.navmenu-and-logo a:hover { 
 
background-color: #A5DFFF; 
 
} 
 
.navmenu-and-logo li { 
 
font-size: 17px; 
 
font-family: Arial, Helvetica, sans-serif; 
 
display: inline-block; 
 
} 
 
.container { 
 
height: 1024px; 
 
} 
 
.backgroundimage1 { 
 
background-image: url('backgroundimage1.jpg'); 
 
background-repeat: no-repeat; 
 
background-size: cover; 
 
height: 550px; 
 
} 
 
.content { 
 
margin: 0 auto; 
 
width: 960px; 
 
padding: 90px 0px 0px 0px; 
 
color: #1C3C4E; 
 
} 
 
.content2 { 
 
margin: 0 auto; 
 
width: 960px; 
 
padding: 100px 0px 0px 0px; 
 
font-family: Arial, Helvetica, sans-serif; 
 
text-align: justify; 
 
color: #1C3C4E; 
 
} 
 
.portfolio { 
 
margin: 0 auto; 
 
width: 960px; 
 
background-color: #C9EEFF; 
 
box-shadow: 0px 1px 5px #CFCFCF; 
 
} 
 
.portfolio a { 
 
padding: 105px 107px 0px 107px; 
 
color: #45ACFF; 
 
text-decoration:none; 
 
height: 150px; 
 
display: block; 
 
} 
 
.portfolio a:hover { 
 
background-color: #A5DFFF; 
 
display: block; 
 
} 
 
.portfolio li { 
 
font-size: 24px; 
 
font-family: Arial, Helvetica, sans-serif; 
 
display: inline-block; 
 
} 
 
.footerbackground { 
 
height: 70px; 
 
width: 100%; 
 
background-color: #1C3C4E; 
 
} 
 
.footer { 
 
font-family: Arial, Helvetica, sans-serif; 
 
width: 960px; 
 
left: 0; 
 
right: 0px; 
 
margin: 0 auto; 
 
} 
 
.lefttext { 
 
float:left; 
 
color: #45ACFF; 
 
padding-top: 25px; 
 
} 
 
.righttext { 
 
float:right; 
 
color: #45ACFF; 
 
padding-top: 25px; 
 
} 
 
.p { 
 
font-size: 14px; 
 
font-family: Arial, Helvetica, sans-serif; 
 
text-align: justify; 
 
}
<!DOCTYPE html> 
 
<html> 
 
<head> 
 

 
<link href="css/style.css" rel="stylesheet"> 
 
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> 
 
<title>Loom | Home</title> 
 

 
</head> 
 
<body> 
 

 

 
<div class="navbackground"> 
 
</div> 
 
<!--Logo an Navigation Menu--> 
 
\t <div class="navmenu-and-logo"> 
 
\t <!--Site Logo--> 
 
\t <div class="logo"> 
 
\t <img src="images/loom1.png"> 
 
\t </div> 
 
\t <!--End of site logo--> 
 

 
\t <!--Navigation Menu--> 
 
\t <div class="menu"> 
 
\t <li><a href="index.html">HOME</a></li> 
 
\t <li><a href="contact.html">CONTACT ME</a></li> 
 
\t </div> 
 
\t <!--End of navigation menu--> 
 
\t </div> 
 

 
<div class="container"> 
 
<!--My Awesome Lemon Background c: --> 
 
<div class="backgroundimage1"> 
 

 
<!--Site Content, paragraphs etc.--> 
 
<div class="content"> 
 

 
\t <!--Title--> 
 
\t <center><h1>LEARN MORE ABOUT ME</h1></center> \t 
 
\t <!--End of Title--> 
 

 
\t <!--First Paragraph--> 
 
\t <p> \t 
 
\t If you'd like to know more about me, I'll try to write some stuff that might interest you, but please know that I am not that interesting, but I guess we could start off with my name and go on from there. 
 
\t My name is Hans, I live in a medium-sized town by the name of Alingsås, Sweden. I am 16 years old and I dedicate my spare time to playing games and doing productive things, such as design, coding, video editing and sometimes building computers. I started with webdesign and coding at the age of 10, and once I found out what amazing stuff you can do with just the tip of your fingers I was hooked! 
 
\t My first website was made for my friend 5 years ago because his dad needed a site for his company, and I didn't mind helping them considering how fun I thought it was. There is NO WAY I'll be able to write down an entire page telling you about myself, this is pretty much all I can think of so it'll have to do. 
 
\t Now you know a little bit more about me, so thanks for reading! 
 
\t </br></br> 
 
\t Om du råkar vilja veta lite mer om mig så ska jag försöka att skriva ner lite saker om mig som kanske intresserar dig, men tänk på att jag inte är speciellt intressant. 
 
\t Jag antar att vi kan börja med mitt namn och sedan fortsätta därifrån. Mitt namn är Hans, jag bor i en medel stor stad vid namn Alingsås. Jag är 16 år gammal och jag dedikerar min lediga tid till att spela spel och mer produktiva saker som att designa, koda, video redigera och bygga datorer. 
 
\t Jag började med att web designa redan när jag var 10 år gammal, och när jag insåg vilka otroliga grejer man kunde göra med bara fingrarna var jag fast! Den första hemsidan jag gjorde var åt en väns pappa för 5 år sen, hans pappa behövde nämligen en hemsida för sitt företag. 
 
\t Finns ingen chans i världen att jag kan skriva ner en hel sida om mig själv så detta får duga. Nu vet du lite mer om mig, så tack för att du tog din tid att läsa! 
 
\t </p> 
 
\t <!--End of the first paragraph--> 
 
</div> 
 
<div class="content2"> 
 
\t <center><h1>MY PORTFOLIO</h1></center> 
 
\t \t <!--Navigation Menu--> 
 
\t <div class="portfolio"> 
 
\t <li><a href="websites.html">WEBSITES</a></li> 
 
\t <li><a href="https://www.mediafire.com/folder/xnjysf1dcmj6h/Photos">IMAGES</a></li> 
 
\t <li><a href="https://www.youtube.com/playlist?list=PLNe5zO4uM4-PUlwnPAsLLXaWYD2ZWQTiD">VIDEOS</a></li> 
 
\t </div> 
 
\t <!--End of navigation menu--> 
 
</div> 
 
</div> 
 
</div> 
 
<div class="footerbackground"> 
 

 
<div class="footer"> 
 
<div class="lefttext"> 
 
\t Loom.pe.hu© 
 
</div> 
 
<div class="righttext"> 
 
\t Website designed by Hans Nilsson 
 
</div> 
 
</div> 
 
</div> 
 
</body> 
 
</html>

+0

你的CSS在哪裏設置一個規則改變嗎? – j08691

+1

除了下面的答案,它也似乎你可能有幾個未封閉的DIV,搞亂了事情。你應該真的努力爲嵌套的HTML元素使用適當的縮進,以便未封閉的元素變得明顯。 –

+1

我們不要忘記大約50年前已棄用'

'元素。 – j08691

回答

5

我沒有看到你更改字體大小爲h1,但你必須.p代替p

+0

所以我只是應該刪除點?... – loomanleet

+1

是的,一個點暗示它是一個類 – cocoa

2

由於@cocoa他回答說,你用一個圓點定義一個非類元素的樣式。正確的格式有:

當改變ph1等:

p{ 
    font-size: 10px; 
} 

當改變類(比如<p class="aClass"></p>):

.aClass{ 
    font-size: 10px; 
} 

改變當IDS(如<p id="someId"></p>

#someId{ 
    font-size: 10px; 
}