关于table-row table-cell_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:39:28
Original
1380 people have browsed it

I recently helped a friend build a website. Since I have no practical experience, I can only learn while doing it. The page is very simple, HTML CSS, and finally uses CSS table layout in the body. Please see the code below.
The red part in the picture is two table-cells, placed inside a table-row. What confuses me is that the width of the cell cannot be adjusted. Using the border attribute has no effect at all. I don't know why. Please help me figure out where this problem lies.

I have never made a website before and I am in a hurry, so the code is a bit messy. Seniors, please work hard and help me figure out how to control the width of the columns. Thanks in advance!

<!doctype html><html><body>    <head>        <title> XX典藏官网-第四套人民币收藏网,第三套人民币收藏,第五套人民币,连体钞,纪念钞,人民币最新价格行情表及图片</title>        <meta http-equiv="X-UA-Compatible" content="IE=7" />         <meta name="baidu-site-verification" content="f8zIsHw8jjfPFf3L" />	    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />        <meta name="keywords" content="  人民币收藏,第四套人民币,第五套人民币,人民币价格,人民币收藏网,人民币收藏价格表,人民币收藏行情,第二套人民币,第四套人民币价格及图片,第三套人民币,第三套人民币价格及图片,第四套人民币大全套,第五套人民币价格表,纪念钞,奥运纪念钞最新价格,金银币价格,连体钞价格及图片">        <link rel="stylesheet" type="text/css" href="css/style_main.css" />	</head>   <body>          <div id="table_body">        <!--页眉-->            <div id="row_shuimo">                <div id="header_shuimo"><img src="./images/header_shuimo.png" width=""/></div>            </div>            <div id="row_nav">                <div id="header_logo">                    <a href="http://www.baidu.com/" alt="XX文化艺术公司"><img src="./images/src_logo.jpg" alt="XX典藏欢迎您"/></a>                </div>	                <div id="header_reg_login">                    <a href="http://www.baidu.com/" title="点击登录">登录   </a>                         <a href="http://www.baidu.com/" title="点击注册">新用户?注册</a>                </div>            </div>        <!--导航条和商品展示区-->            <!--行-->            <div id="row_show">                <div id="cell_list">                    <ul>                        <li id="li_nav_all"><strong>全部藏品分类</strong></li>                        <li id="li_nav_rmb">人民币收藏</li>                        <li id="li_nav_stamp">邮票收藏</li>                        <li id="li_nav_jinianbi">纪念币收藏</li>                        <li id="li_nav_lianti">连体收藏类</li>                        <li id="li_nav_jinyinbi">金银币类</li>                        <li id="li_nav_antique">古玩字画</li>                   </ul>                </div>                <!-- 行 -->                <div id="cell_goods">                    <div id="goods_table">                        <div id="goods_row1">                            <div id="cell_row1">                                <ul>                                    <li>                                        您的当前位置:首页                                      </li>                                    <li>                                        藏品展示区                                    </li>                                </ul>                            </div>                        </div>                           <div id="goods_row2">                            <p>goods </p>                        </div>                    </div>                </div>        </div>                <!--页脚-->        <div id="row_footer">            <div class="footer_div" id="footer_400">                <h3>咨询热线</h3>                <p>400-000-0000</p>            </div>            <div class="footer_div">                <ul class="footer_ul">                    <li>关于我们</li>                    <li><a href="footer/1.html">XX典藏简介</a></li>                    <li><a href="footer/1.html">企业文化</a></li>                    <li><a href="footer/1.html">招商与合作</a></li>                </ul>            </div>                            <div class="footer_div">                <ul class="footer_ul">                    <li>交易指南</li>                    <li><a href="footer/1.html">购物流程</a></li>                         <li><a href="footer/1.html">免责声明</a></li>                </ul>            </div>            <div class="footer_div">                    <ul class="footer_ul">                        <li>支付配送</li>                        <li><a href="footer/1.html">支付方式</a></li>                        <li><a href="footer/1.html">商品配送</a></li>                        <li><a href="footer/1.html">注意事项</a></li>                    </ul>            </div>        </div>    </div>  </body>  </html>
Copy after login


Here is style_main.css:
*{margin:0; padding:0;}/*页眉*/#header #header_nav ul li{	list-style-type:none;	float:right;	}#table_body{	display:table;	margin-left:auto;	margin-right:auto;}#table_body #row_shuimo{	display:table-row;	height:100px;	text-align:center;}#table_body #row_shuimo #header_shuimo{	display:table-cell;	}#table_body #row_nav{	display:table-row;		vertical-align:top;}#table_body #row_nav #header_logo{	display:table-cell;	width:300px;}#table_body #row_nav #header_reg_login{	display:table-cell;}/*展示部分*/#table_body #row_show{	display:table-row;	height:700px;}#table_body #row_show #cell_list{	display:table-cell;	border:solid,20px,#cc0;	border-radius:15px;	border-color:green;}#table_body #row_show #cell_goods{	display:table-cell;}#cell_list ul{	list-style-type:none;	width:130px;	/*color:purple;	*/	background-color:white;	border-style:solid;	border-top-left-radius:10px;	/*border-color:Red;*/	border-width:2px;	padding:0px;	/*float:left;*/}#table_body #row_show #cell_list ul li{	height:30px;	font-size:15px;	color:orange;	text-align:center;	border-style:solid;}#table_body #row_show #cell_list ul #li_nav_all{	color:Orange;	background-color:Green;	border-top-left-radius:8px;	border-top-right-radius:8px;}/*cell_goods*/#goods_table{	display:table;	height:inherit;}#goods_row1{	display:table-row;}#goods_row2{	display:table-row;}#cell_row1{	display:table-cell;	margin-left:0;}/*页脚部分*/ #row_footer{	display:table-row;} .footer_div{	display:table-cell;	width:20%;	height:100px;	float:left;} #row_footer #footer_400{	margin-left:150px;} .footer_ul{	list-style-type:none;	margin-left:10px;}
Copy after login


Reply to discussion (solution)

It’s easy to just adjust the width.

#cell_list ul{	width: 500px;}
Copy after login
Copy after login

As for the border, I use the Chrom browser and it is displayed.
A few suggestions: 1. Do not put divs in span tags. The tag is used to combine inline elements in the document, usually text;
2. Do not use the id attribute frequently on the page. On the one hand, it is not conducive to code reuse, on the other hand, it is prone to naming conflicts and script errors.

It is easy to just adjust the width,

#cell_list ul{	width: 500px;}
Copy after login
Copy after login

As for the border, I use the Chrom browser and it is displayed.
A few suggestions: 1. Do not put divs in span tags. The tag is used to combine inline elements in the document, usually text;
2. Do not use the id attribute frequently on the page. On the one hand, it is not conducive to code reuse, on the other hand, it is prone to naming conflicts and script errors.



Thank you for taking the time to read my code patiently.
The border problem has been solved. It was due to my own CSS syntax error that it could not be displayed. well! But the width problem is still not solved.
Please take a look at the picture below first. 1 and 2 are in one row, 3 and 4 are in one row, and 5 and 6 are in another row. The HTML code has not changed, but no matter how I set the width attributes of table, row and cell in CSS, it has no effect. Don't know why. Paste the image and CSS code below:

*{margin:0; padding:0;}/*页眉*/#table_body{	display:table;	margin-left:auto;	margin-right:auto;}#row_shuimo{	display:table-row;	height:100px;}#header_shuimo{	display:table-cell;		border:solid;	width:200px;}#header_test{display:table-cell;border:solid;}#table_body #row_nav{	display:table-row;		width:300px;}#table_body #row_nav #header_logo{	display:table-cell;	border:solid 5px red;	margin-right:300px;	}#table_body #row_nav #header_reg_login{	display:table-cell;}/*展示部分*/#table_body #row_show{	display:table-row;	height:700px;}#table_body #row_show #cell_list{	display:table-cell;	border-radius:15px;	border-color:green;	border:solid;}#table_body #row_show #cell_goods{	display:table-cell;	border:solid;}#cell_list ul{	list-style-type:none;	width:130px;	/*color:purple;	*/	background-color:white;	border-style:solid;	border-top-left-radius:10px;	/*border-color:Red;*/	border-width:2px;	padding:0px;	/*float:left;*/}#table_body #row_show #cell_list ul li{	height:30px;	font-size:15px;	color:orange;	text-align:center;	border-style:solid;}#table_body #row_show #cell_list ul #li_nav_all{	color:Orange;	background-color:Green;	border-top-left-radius:8px;	border-top-right-radius:8px;}/*cell_goods*/#goods_table{	display:table;	height:inherit;	border:solid;}#goods_row1{	display:table-row;}#goods_row2{	display:table-row;}#cell_row1{	display:table-cell;	margin-left:0;}/*页脚部分*/ #row_footer{	display:table-row;} .footer_div{	display:table-cell;	width:20%;	height:100px;	float:left;} #row_footer #footer_400{	margin-left:150px;} .footer_ul{	list-style-type:none;	margin-left:10px;}
Copy after login

Another table-cell is added to HTML, and the id in CSS is header_test

Browser Press F12 to view the elements. Check the id of the element you want to change, and then change the css. As for the problem that width does not take effect, I think it is because the right element is not selected

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template