2017-04-25 28 views
-1

您好研究员谁的技术人员将解决你的亲戚电脑免费,格式时遇到问题网站所有决议案

反正,我是一个相当新的编码器,和我只是还在HTML/CSS初学者。作为第一个项目,我为爸爸做了一个网站作为生日礼物,因为他在15年内没有更新他的小企业网站,并且通过他的代表获得大部分工作,但我想帮助他并将其带入21世纪。

无论如何,我遵循了几个关于如何创建一个简单网站的YT教程,但ATM我的网站大约是800px,而且看起来像他目前的网站,因为无论您的屏幕大小如何,文本只填满约1/3-1/2的屏幕。

我首先要做的主要事情是背景颜色,尤其是标题,以放弃屏幕,其次,文本/图片要随着您更改浏览器大小而进行缩放。

我试着在其他线程上寻找一些答案,但我很难理解,因为其他人有他们自己的分隔符和变量的名称。

这是我的HTML和CSS的一部分。当然,我会剪掉大部分代码,如大多数文本,文本格式等,以及名称和地方。

HTML:

<DOCTYPE html> 
<html> 
<head> 
<title>Website</title> 
<link rel="stylesheet" type="text/css" href="style.css"/> 
</head> 
<body> 
<div id="container"> 
<div id="header"> 
<h1>Dad's Company</h1> 
</div> 
<div id="content"> 
<div id="main"> 
<h2>Person Name</h2> 
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p> 
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p> 
</div> 
</div> 
<div id= "footer"> 
Copyright &copy; 2017 Ye Co. 
</div> 
</div> 
</body> 
</html> 
---------- 

这是CSS

body { 
    background-color: #FFFFFF; 
    overflow-x: hidden; 
    width: 100%; 
    height: 100%; 
} 

h1 { 
    margin-left: 10px; 
    padding: 30px; 
    text-align: center; 
} 

h2 { 
    color: #4F4F4F; 
    text-align: center; 
} 

#header { 
    background-color: #992626; 
} 

#container { 
    background-color: #DDDDDD; 
    width: 800px; 
    margin-left: auto; 
    margin-right: auto; 
} 

#site { 
    overflow-x: hidden; 
} 

#content { 
    padding: 10px; 
    text-align: center; 
    float: right; 
} 

#main { 
    width: 600px; 
    float: center; 
} 

#footer { 
    clear: both; 
    font-size: 15; 
    text-align: right; 
    padding: 5px; 
    background-color: #992626; 
    font-family: serif; 

谢谢! 我希望你们能通过我乱七八糟的编码找到答案。如果你们可以给我一些关于你的代码的例子,告诉我一个解决方案,它也将有所帮助。谢谢!

+0

尝试使用引导的网格布局。它使这种事情变得非常简单。 –

+0

谢谢,无论如何,我喜欢通过搞乱别人的代码来学习。但也许有人会在我搞清楚之前得到答案。 –

回答

-1

删除id =“main”,您可以正确对齐段落。

+0

我不认为你读过这个问题。我试图让头部的背景颜色在网页上传播,即使在不同的分辨率下也是如此。我已经知道“主要”文本对齐方式,因为我在那里放置了其他文本,为了清除问题的代码,我排除了其他文本。 –

-1

<DOCTYPE html> 
 
<html> 
 
<head> 
 
<title>Website</title> 
 
<link rel="stylesheet" type="text/css" href="style.css"/> 
 
<style> 
 
body { 
 
    background-color: #FFFFFF; 
 
    overflow-x: hidden; 
 
    width: 100%; 
 
    height: 100%; 
 
} 
 

 
h1 { 
 
    margin-left: 10px; 
 
    padding: 30px; 
 
    text-align: center; 
 
} 
 

 
h2 { 
 
    color: #4F4F4F; 
 
    text-align: center; 
 
} 
 

 
#header { 
 
    background-color: #992626; 
 
} 
 

 
#container { 
 
    background-color: #DDDDDD; 
 
    width: 800px; 
 
    margin-left: auto; 
 
    margin-right: auto; 
 
} 
 

 
#site { 
 
    overflow-x: hidden; 
 
} 
 

 
#content { 
 
    padding: 10px; 
 
    text-align: center; 
 
    float: right; 
 
} 
 

 
#main { 
 
    width: 600px; 
 
    float: center; 
 
} 
 

 
#footer { 
 
    clear: both; 
 
    font-size: 15; 
 
    text-align: center; 
 
    padding: 5px; 
 
    background-color: #992626; 
 
    font-family: serif; 
 
} 
 
</style> 
 
</head> 
 
<body> 
 
<div id="container"> 
 
<div id="header"> 
 
<h1>Dad's Company</h1> 
 
</div> 
 
<div id="content"> 
 
<div > 
 
<h2>Person Name</h2> 
 
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p> 
 
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p> 
 
</div> 
 
</div> 
 
<div id= "footer"> 
 
Copyright &copy; 2017 Ye Co. 
 
</div> 
 
</div> 
 

 

 
</body> 
 
</html>