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="/static/imghwm/default1.png" data-src="./images/header_shuimo.png" class="lazy" style="max-width:90%"/ alt="关于table-row table-cell_html/css_WEB-ITnose" ></div> </div> <div id="row_nav"> <div id="header_logo"> <a href="http://www.baidu.com/" alt="XX文化艺术公司"><img src="/static/imghwm/default1.png" data-src="./images/src_logo.jpg" class="lazy" 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 id="咨询热线">咨询热线</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>
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;}
Reply to discussion (solution)
It’s easy to just adjust the width.
#cell_list ul{ width: 500px;}
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;}
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;}
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

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

WebStorm Mac version
Useful JavaScript development tools