html宽度设置100%后浏览器里怎么只有一半

html宽度设置100%后浏览器里怎么只有一半,第1张

html宽度设置100%后浏览器里只有一半,以以下代码为例

检测一下body的css里面是否定义了宽度

另外,也可以给body一个属性width:1200%;

<head>

<meta

http-equiv="Content-Type"

content="text/html

charset=utf-8"

/>

<title>无标题文档</title>

<style

type="text/css">

<!--

body{

padding:0px

margin:0px}

.top{

width:100%

height:80px

border:1px

#000

solid

margin:0px

auto

display:block}

.top1{

width:1200px

height:80px}

-->

</style>

</head>

<body>

<div

class="top">

<div

class="top1"></div>

</div>

</body>

</html>

要使用div做一个表格,主要需要应用到css中的border表框属性,这样看起来才像是一个表格。示例代码如下:

html代码:

<div class="table">

<div class="col">第一个单元格</div>

<div class="col">第二个单元格</div>

</div>

CSS代码:

.table{width:500pxheight:150pxmargin:0px autoborder:1px solid #000border-left-width:0}

.col{width:249pxheight:100%border-left:1px solid #000float:left}

demo效果截图如下:

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>div最分最</title>   

<style type="text/css">

*{ padding:0 margin:0}

.content{ width:100 height:50vw background:#063}

</style>

 

</head>

 

<body>   

        <div class="content"></div>

    <!--viewport:可视窗口,也就是浏览器。,vw Viewport宽度, 1vw 等于viewport宽度的1%,vh Viewport高度, 1vh 等于viewport高的的1%(深圳网站建设www.sz886.com)-->

    

    

</body>

</html>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/7205393.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-02
下一篇 2023-04-02

发表评论

登录后才能评论

评论列表(0条)

保存