Table of Contents
Like the moderator. Correct answer upstairs.
Home Web Front-end HTML Tutorial div block centered display_html/css_WEB-ITnose

div block centered display_html/css_WEB-ITnose

Jun 24, 2016 am 11:59 AM
div center show

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        #divbg
        {
            width: 98%;
            margin-left: auto;
            margin-right: auto;
        }
        #divbg li
        {
            float: left;
            background: rgb(231,231,231);
            width: 180px;
            height: 180px;
            font-size: 20px;
            list-style-type: none;
            cursor: hand;
            line-height: 40px;
            text-align: center;
            cursor: pointer;
            margin-bottom: 2%;
            margin-top: 4%;
            margin-left: 5.5%;
            margin-right: 5.5%;
        }
        #box
        {
            margin:0 0 0 0;
            position: absolute;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <script src="libraryjs/mainnews.js" type="text/javascript"></script>
    <div id="box">
        <div id="P_1" style="overflow: hidden;">
            <ul id="divbg">
                <li>
                    <div>
                        <a class="a">旅游</a><br />
                        <a href="OrderZX.aspx">待审订单(<font color="red"><%= lvyou%></font>个)</a><br />
                        <a href="TeamList.aspx">待审团队(<font color="red"><%= tuandui%></font>个)</a><br />
                        <a href="LineSearch.aspx">产品预订</a></div>
                </li>
                <li>
                    <div>
                        <a>签证</a><br />
                        <a href="QianZhenOrder.aspx?TY=sd">待审订单(<font color="red"><%= qianzheng%></font>个)</a><br />
                        <a href="QZOrderList.aspx">产品预订</a></div>
                </li>
                <li>
                    <div>
                        <a>订房</a><br />
                        <a href="#">待审订单(<font color="red"><%= dingfan%></font>个)</a><br />
                        <a href="#">产品预订</a></div>
                </li>
                <li>
                    <div>
                        <a>门票</a><br />
                        <a href="SpotOrder.aspx?TY=sd">待审订单(<font color="red"><%= menpiao%></font>个)</a><br />
                        <a href="SpotCPList.aspx">产品预订</a></div>
                </li>
                <li>
                    <div>
                        <a>租车</a><br />
                        <a href="CarOrder.aspx?TY=sd">待审订单(<font color="red"><%= zuche%></font>个)</a><br />
                        <a href="CarSearch.aspx">产品预订</a></div>
                </li>
                <li>
                    <div>
                        <a>公文</a><br />
                        <a href="GongWenManger.aspx?TY=gg&tabs=sysb">待阅公文(<font color="red"><%= gongwen%></font>个)</a><br />
                        <span id="spanadd" style="display: none"><a href="javascript:void(0)"
target="_self">发布公文</a></span>
                    </div>
                </li>
                <li>
                    <div>
                        <a>留言</a><br />
                        <a href="GongWenManger.aspx?TY=gg&tabs=sdly">待复留言(<font color="red"><%= liuyan%></font>个)</a><br />
                        <a href="javascript:void(0)" target="_self">发布留言</a></div> </li>
<li>
                                                                                                                      " "CWCDayList.aspx">Pending financial affairs (<font color="red"><%= caiwu%></font>)</a><br />
<span id="sw" style="display: none"><a href="javascript:void(0)"
                                                                                                                        because /span></div>
                                             🎜> </form>
</body>
</html>

The code is as above. The function I want is to display eight small blocks in the center. Initially, there are 4 in each row. The window shrinks and becomes larger. The small blocks among them also need to be centered. Small The block size is fixed at 180*180. I have been debugging the css for a long time, but I still can’t adjust it. . . .




Reply to the discussion (solution)

Is there anyone here? ? ? ? ?

Don’t you think it looks better this way?

Like the moderator. Correct answer upstairs.

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to remove news and trending content from Windows 11 Search How to remove news and trending content from Windows 11 Search Oct 16, 2023 pm 08:13 PM

How to remove news and trending content from Windows 11 Search

iOS 17's standby mode turns a charging iPhone into a home hub iOS 17's standby mode turns a charging iPhone into a home hub Jun 06, 2023 am 08:20 AM

iOS 17's standby mode turns a charging iPhone into a home hub

Windows 11 User Guide: How to disable ad pop-ups Windows 11 User Guide: How to disable ad pop-ups Sep 22, 2023 pm 07:21 PM

Windows 11 User Guide: How to disable ad pop-ups

Reasons and solutions for desktop layout being locked Reasons and solutions for desktop layout being locked Feb 19, 2024 pm 06:08 PM

Reasons and solutions for desktop layout being locked

How to make a remote desktop connection display the other party's taskbar How to make a remote desktop connection display the other party's taskbar Jan 03, 2024 pm 12:49 PM

How to make a remote desktop connection display the other party's taskbar

How to display the wifi password QR code? It is recommended to scan the wifi password on WeChat in 3 seconds. How to display the wifi password QR code? It is recommended to scan the wifi password on WeChat in 3 seconds. Feb 20, 2024 pm 01:42 PM

How to display the wifi password QR code? It is recommended to scan the wifi password on WeChat in 3 seconds.

Samsung will provide displays for Microsoft's MR headsets, and the devices are expected to be lighter and have clearer displays Samsung will provide displays for Microsoft's MR headsets, and the devices are expected to be lighter and have clearer displays Aug 10, 2024 pm 09:45 PM

Samsung will provide displays for Microsoft's MR headsets, and the devices are expected to be lighter and have clearer displays

How to set WPS table centering How to set WPS table centering Mar 19, 2024 pm 09:34 PM

How to set WPS table centering

See all articles