导航:首页 > 万维百科 > html5网页设计思路

html5网页设计思路

发布时间:2020-10-04 12:23:40

1、制作一个HTML5网页

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
 content="width=device-width;user-scalable=no;initial-scale=1.0;maximum-scale=1.0;minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="/data.php">
</head>
<body>
<script>let student = new Object;
student.no = 1;
student.name = "大企鹅";
student.sex = "男";
student.born = "1995-09-25";
student.score = 0;
student.learn = function () {
    student.score += 10
};
student.age = function () {
    let returnAge;
    // 根据生日计算年龄("1995-09-25")
    //以下五行是为了获取出生年月日,如果是从身份证上获取需要稍微改变一下
 let strBirthdayArr = student.born.split("-");
    let birthYear = strBirthdayArr[0];
    let birthMonth = strBirthdayArr[1];
    let birthDay = strBirthdayArr[2];
    d = new Date();
    let nowYear = d.getFullYear();
    let nowMonth = d.getMonth() + 1;
    let nowDay = d.getDate();
    if (nowYear == birthYear) {
        returnAge = 0;//同年 则为0岁
 } else {
        let ageDiff = nowYear - birthYear; //年之差
 if (ageDiff > 0) {
            if (nowMonth == birthMonth) {
                let dayDiff = nowDay - birthDay;//日之差
 if (dayDiff < 0) {
                    returnAge = ageDiff - 1;
                } else {
                    returnAge = ageDiff;
                }
            } else {
                let monthDiff = nowMonth - birthMonth;//月之差
 if (monthDiff < 0) {
                    returnAge = ageDiff - 1;
                } else {
                    returnAge = ageDiff;
                }
            }
        } else {
            returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天
 }
    }

    return returnAge;//返回周岁年龄
};
document.body.innerHTML += student.score + "<br>";
document.body.innerHTML += student.age();
</script>
</body>
</html>

需要自定义年龄,初分数。

Usage: 学习: student.learn() 计算年龄: student.age()

2、html5网页设计期末作业,要求是一个网站(至少4个网页)

按F12或者右键→检查 可查看网页源代码,左上角元素下面的图标,可让你看具体区域的代码,右面那一列是CSS样式,你找几个简单的网页把代码复制过来慢慢改呗

3、HTML5是什么意思,网页设计?

关于HTML5的解释简要如下:
1、HTML5是HTML最新的修订版本,2014年10月由万维网联盟(W3C)完成标准制定。目标是取代1999年所制定的HTML 4.01和XHTML 1.0标准,以期能在互联网应用迅速发展的时候,使网络标准达到符合当代的网络需求。广义论及HTML5时,实际指的是包括HTML、CSS和JavaScript在内的一套技术组合。它希望能够减少网页浏览器对于需要插件的丰富性网络应用服务(Plug-in-Based Rich Internet Application,RIA),例如:Adobe Flash、Microsoft Silverlight与Oracle JavaFX的需求,并且提供更多能有效加强网络应用的标准集。
2、具体来说,HTML5添加了许多新的语法特征,其中包括<video>、<audio>和<canvas>元素,同时集成了SVG内容。这些元素是为了更容易的在网页中添加和处理多媒体和图片内容而添加的。其它新的元素如<section>、<article>、<header>和<nav>则是为了丰富文档的数据内容。新的属性的添加也是为了同样的目的。同时也有一些属性和元素被移除掉了。一些元素,像<a>、<cite>和<menu>被修改,重新定义或标准化了。同时APIs和DOM已经成为HTML5中的基础部分了。HTML5还定义了处理非法文档的具体细节,使得所有浏览器和客户端程序能够一致地处理语法错误,ITJOB。

4、HTML5网页前端设计中如下图表单的代码怎么写?

下面是表单代码,你直接再加属性就可以了,表单用 table 写比较简单,div 太麻烦了;
<html xmlns=" http://www.dayinmandarin.com ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>黑板</title>
</head>
<body>
<div style="width:500px;">
<h1 style="width:500px;height:50px;color:#2A8DF0;border-bottom:#2A8DF0 solid 3px; text-align:center;">用户注册页面</h1>
<table cellpadding="0" cellspacing="10" style="margin:0 auto;">
<tr>
<td align="right" valign="top"><div>用户名:</div></td>
<td><input style='width:250px' value='请输入用户名' /></td>
</tr>
<tr>
<td align="right" valign="top"><div>密 码:</div></td>
<td><input style='width:250px' value='请输入密码' /></td>
</tr>
<tr>
<td align="right" valign="top"><div>确 认:</div></td>
<td><input style='width:250px' value='请再次输入密码' /></td>
</tr>
<tr>
<td align="right" valign="top"><div>姓 名:</div></td>
<td><input style='width:250px' value='请输入真实姓名' /></td>
</tr>
<tr>
<td align="right" valign="top"><div>邮 箱:</div></td>
<td><input style='width:250px' value='请输入电子邮箱' /></td>
</tr>
</table>
<div align="center"><input style="width:100px;height:30px;text-align:center;line-height:30px;background:#2289F0;border:#2289F0;color:white;font-weight:bold;font-size:16px;" type="submit" value="提交注册" /></div>
</div>
</body>
</html>

5、网页设计Html5

左边的左浮动,右边的右浮动,没有问题的。

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
#div0 {
    width: 800px;
}
#divL {
    width: 598px;
    height: 300px;
    float: left;
    background-color: #ddd;
}
#divR {
    width: 200px;
    height: 300px;
    background-color: #eee;
    float: right;
}
#l1 {
    height: 50px;
    background-color: #888;
}
#l2 {
    height: 100px;
    background-color: #aaa;
}
</style>
</head>
<body>
<div id='div0'>
  <div id='divL'>
    <div id='l1'>左浮动内容1</div>
    <div id='l2'>左浮动内容2</div>
  </div>
  <div id='divR'>右浮动内容</div>
</div>
</body>
</html>

显示结果:

6、网页设计与HTML5的关系

网页设计是根据企业希望向浏览者传递的信息(包括产品、服务、理念、文化),进行网站功能策划,然后进行的页面设计美化工作。作为企业对外宣传物料的其中一种,精美的网页设计,对于提升企业的互联网品牌形象至关重要。
网页设计一般分为三种大类:功能型网页设计(服务网站&B/S软件用户端)、形象型网页设计(品牌形象站)、信息型网页设计(门户站)。设计网页的目的不同,应选择不同的网页策划与设计方案。
网页设计的工作目标,是通过使用更合理的颜色、字体、图片、样式进行页面设计美化,在功能限定的情况下,尽可能给予用户完美的视觉体验。高级的网页设计甚至会考虑到通过声光、交互等来实现更好的视听感受。
万维网的核心语言、标准通用标记语言下的一个应用超文本标记语言(HTML)的第五次重大修改。
2014年10月29日,万维网联盟宣布,经过接近8年的艰苦努力,该标准规范终于制定完成。

7、如何用HTML5制作网页

html5标签掌握了,从上到下从左到右,标签合理使用,先把框架搭好,再结合css3做效果,先花时间把html5 css3看两遍,再看网页设计html5制作教程就ok了

当然这只是最简单的

8、HTML5怎么制作响应式网页

1.调整视口

代码实例:

<!DOCTYPE html>
<head>
    <meta charset="UTF-8" />
    <title>布局之路-移动端开发实例</title>
    <meta name="viewport" content="width=device-width,user-scalable = no" />
    <link rel="stylesheet" type="text/css" href="css/reset.css" />
</head>
<body>
    <div class="wrap"></div>
</body>
</html>

代码解析:由于使用不同设备打开网页时,宽度均有所不同,所以不能讲视口设置为固定值,应当为width=device-width,即将视口设置为当前设备的宽度。

2.确定设计图的最小字体

浏览器(部分)能够显示的最小字体未12px,当移动端页面宽度为320px时,要保证最小字体为12px,那么在1080px的设计图中,最小字体应当为42px。

代码实例:

    <style type="text/css">
        html {
            font-size: 42px;
        }
    </style>

3.浮动布局

各个区块都是浮动的,不是固定不变的。为了能自适应各个窗口。

代码实例:

.main {
  float: left;
  width: 70%;
}
.box {
    float: left;
    width: 60.93%;
    font-size: 1.71rem;
    text-align: center;
    line-height: 4.64rem;
}

float浮动的好处就是,如果宽度不够放置下这个元素,元素会自动滚动到下方。

4.通过媒介查询,为不同设备加载相应样式

有条件应用样式:

 <style>
    @media all and(min-width:500px){ ... }
    @media (orientation){ ... }
</style>

代码解析:

第一行媒体查询代码指的是:为宽度大于等于500px的设备设置样式。

第二行媒体查询代码指的是:为纵屏状态(可见区域大于或等于宽度)下的移动端设备设置样式。

有条件的加载样式表:

<head>
    <link rel="stylesheet" href="wide.css" media="screen and(min-width:1024)" />
    <link rel="stylesheet" href="mobile.css" media="screen and(max-width:320)" />
</head>

代码解析:

第一行媒体查询代码指的是:为宽度大于等于1024px的设备,加载wide.css文件。

第二行媒体查询代码指的是:为宽度小于等于320px的设备,加载mobile.css文件。

5.使用百分比和rem替换px

除了布局和文本,"自适应网页设计"还必须实现图片的自动缩放。

代码效果对比:

/*使用固定像素*/
.box {
    float: left;
    width: 658px;
    font-size: 72px;
    text-align: center;
    line-height: 195px;
}
/*使用百分比和rem*/
.box {
    float: left;
    width: 60.93%;
    font-size: 1.71rem;
    text-align: center;
    line-height: 4.64rem;
}

代码解析:

水平方向的值,将具体像素调整为百分比。百分比的计算是根据父级的内容区宽度进行计算的。

例如,父级宽度为1080px, 子级元素为197px,那么子元素转换为百分比为:197/1080*100%=18.24%。需要注意的是百分比根据父级计算,当标签结构级别不同时,计算公式中的“分母”也有所不同,在开发时这个地方很容易出现问题,请务必注意。

垂直方向的值,将具体像素调整为rem,与水平方向相比,垂直方向的计算就比较简单。例如,行高为195px,HTML标签当前的字体大小为42px,将行高转换为rem单位,即195/42= 4. 64rem。

9、html5网页制作+javascript

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>test</title>
<script type="text/javascript">
 function Student(id, name, gender, birthday, score) {
        this.id = id;
 this.name = name;
 this.gender = gender;
 this.birthday = birthday;
 this.score = score;
 this.study = function () {
            this.score = this.score === 100 ? this.score : this.score += 1;
 };
 this.getAge = function () {
            return new Date().getFullYear() - new Date(birthday).getFullYear()
        };
 }
 
    var student = new Student(1,'张三','男','1996-2-12',20);
 console.log('学习成绩:'+student.score);
 console.log('年龄:'+student.getAge());
 student.study();
 console.log('学习成绩:'+student.score); //学分加1
 student.study();
 console.log('学习成绩:'+student.score); //学分加1
</script>
<body>
请打开浏览器控制台查看日志输出效果。
</body>
</html>

与html5网页设计思路相关的知识