第一步:先创建一个盒子,定义类为 nav,width 1000,height 40px,防京东的导航,与浏览器顶部100px,margin-top:100px,看的更直观

第二步:使用无序列表放置,导航条的内容,这个可以自己定,这里设定 ul 宽1000px;高 40px;因为ul是块状元素,出现下面的样子,可以思考块状元素在firefox中和 ie6下面有什么不同。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjEAAADTCAIAAAD/HtUDAAAQ2ElEQVR4nO3dMY8kRxnG8ZFl+SBBF2DLEpZONlhOEAEgM5gjwXAScuQcNr2AhIiTkKUd5MCRc+IViS/iExDsCQLSSy/wEsyX2Ntrgpnr7emuqq6q7nrft2r/Pz1Cc7M9s3e45n22e3q2Nx0AADZstP8CAAAc0UkAACvoJACAFXQSAMAKOgkAYIV0Jz19+lT4OwIAakEnAQCsoJMAAFbQSQAAK+gkAIAVdBIAwAo6CQBgBZ0EALCCTgIAWEEnAQCsoJMAAFbQSQAAK+gkAIAVdBIAwAo6CQBgBZ0EALCCTgIAWEEnAQCsoJMAAFbQSQAAK+gkAIAVdBIAwAo6CQBgRUInPV1JuX8MAKBq0vtJAAD40EkAACvoJACAFXQSAMAKOgkAYAWdBACwgk4CAFhBJwEArKCTAABW0EkAACvoJACAFXQSAMAKOgkAYAWdBACwgk4CAFhBJwEArKCTAABW0EkAACvoJEDU/tNHhMRHe8FKo5MAUeozbrPZJN1PdKO9YKXRSYAo9Rm3d9WPs5A2cdT/OW1He8FKo5MAUVqjLbJgAjVD/ahEe8FKo5MAUeozrk9Sx1BIWtFesNLoJECU+ow7JL5jOGqnG+0FK41OAkTpDriMo3YcytON9oKVRicBonQHXLhIZjvJd5uUi/aClUYnAaJ0BxydVF20F6w0OgkQterA+ukfjofc3vtH3EMWHrujk+SjvWCl0UmAqPWm1cO/3R+Uyf2P/h3xKPaTqov2gpVGJwGiVptWv/zo5yd7OFG7SnRSddFesNLoJEDUetMqcz8p+9jd4cboj6R0tBesNDoJELXqwMp5P2n5V2kjyWgvWGl0EiBKd8Bld9LoS9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M638ZzMh4A3EEtz8H468wehIsk9bGBDegkFHLyabPjR8eO1yhx/WLD1wa/+ZBfEAVdzMETm8n5dakP9D1kdo+KTsJKZn411MjN7vSDz4Aq5uCJ5Z2U9Ki87wUEpXTS5Y5CginMQbeN/9OssadDuN5VSvpGQJb4Trq64apXMIZR6CXWExQSVhXfSYcvXbwc/8JDQA3TEGiMo5Mm5zic3Vy9/p25tz10+ZJagjY6CWhM9H7S5e7acbVG52UeASF0EtCY6E6aXkH45OJYgAI6CWhMYicNv0QnQRudBDQm7by7kzeQuIA9tNFJQGNSP5/UH7675DLBUEcnAe3I+d1C/GIhWEInAQCsoJMAAFbQSQAAK+gkALAr8jdnNuMO/VMBoDp0EgDACjoJAGAFnQQAsIJOAgBYMe2k3W6n9ZcRQCcBgF10EgDAikMnDXuITgIA6NhsNufn53QSAEDf+fn5oZN62n+jsugkALBrup/UNjoJAOyavp/UNjoJAOzi80kAAOigkwAAVtBJAAAr/g/+7vvo6njvKwAAAABJRU5ErkJggg==" alt="" />

通常在写样式的时候,要初始化我们的css样式表,这里具体用到哪些,初始哪些,具体设置 list-style:none; margin:0;padding:0;

第三步:现在所有的栏目都是紧挨着,我们要给li设置宽度为100px,通过float:left 将他们分开,给li加一个 背景色blue,知道我们所处的位置,更好的去调节我们的页面aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfcAAABSCAIAAADGsQqZAAAEpElEQVR4nO3WbY7bOgxGYe3tAt3/Ku422n/FIPowlcyYMvscHBQex3ZMUnqb9hsAUJeW/QIAgB9EygNAZaQ8AFRGygNAZaQ8AFRGygNAZaQ8AFRGygNAZaQ8AFRGygNAZbZTvjWS/Of8/79fD/WTlG+TdszOs+/Mbg/bkR0+7X3Ot1LHtmp5o/BTepUe1ikpPxzAcCRB8ge5s/Je3nxRTusOLlfw5flz2hX8j6fG3NeFzKbfn39c1euG/Nz1BzUqPazvTPktTp/cu7buuM0veLkmGA2PaF3knZ9V0VbJu21pOw85092NHyf4LWm1p4d11m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eAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKiMlAeAykh5AKjMHwf15Ac+KCduAAAAAElFTkSuQmCC" alt="" />,现在暂不去掉背景色,给 li 添加高度 height:40px;使用 line-height:40px; 垂直居中,text-align:center; 水平居中。 效果如右 aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAd4AAABVCAIAAABo/BI7AAAEhElEQVR4nO3UW5KrOBBFUebWET3/UfQ0qn990YMUNuXDZe3YUUGBwMqUdLYfAEAY27cnAADYI5oBIA7RDABxiGYAiEM0A0AcohkA4hDNABCHaAaAOEQzAMQhmgEgDtEMAHGIZgCIQzQDQByiGQDiEM0AEIdoBoA4zkTztpHk4/zvn39/TdFMkiVFM0nGKZpJMk7RTJJximaSjFM0k2Scopkk4xTNJBmnaCbJOEUzScYpmkkyzidH87Z4/zm2HVjt1XarTt5lnjnesWNLcz5R4Id78uRo7naz298iV8/2XIG7GU6mvTUXh9vu8H5mW9qpHs7zXut+rpDRrmjv367qE3NeGv/5hjwwmpf4pWW4zK253sYDdmOK5/bWLarU8ndUujThUVu2lY98vcylA16n+CvvlvDAaJ5vxM8O/rrtuWr3VqXGUdXby8WF2/TK5rQtOuxk5X6slRUfbZvJcn+9rkrVJ9a33qgTX5spmutNvF307KprT1e3/G5Fh1uwuGVD3NW4jR/VO3AXK9WNts1kz3y9rmLJS4t7OOzC/f/YaD6kvn7J+7Itar5N62dv3rHYnrz2YbL09YpiK510oFJ+O/6n9zS/CZfOdt6ot3xyNK8+bZfh4yt9aZnzTfMaRtufN9uj236/eD/HSR8m/TlsSL6He3v37y5xuiub2YTJ6nR3coUTzTypaK4/He3FzH05mmclWbbm3cPv7z7YPcBR1o/fX2Y3X7bxmK35OxqT42Qdt9qwYlEXFv7kaJ5zuKi/sTyfKHN3vTtj88kfltZ+Z+n7IZ1ZKvnudlO4e7MdMFrWGzWtPtViNK/GSNUnR/Pq05tG826jjM7YEm3tu4vdrwRaP06T2idvxTpfvtGYrTd+9PrXXaLSqKWunvvCXtF8rtGj6zTnZ+xwXx6W1h7O4ve/bv1MVtY9udJRdZP517dN/kKPyu8+mjP5VPf6rbY8OZqXlqHt+GcW4GLrZ6xtzugLozZ2uxTrrq7JtA9PYH6xbTlb7+aknLZdr+seW/68kNV35z1pr99qy5Oj+f2nsTtysmPmk+8ettFh3iXa6PuZXeoe2lFPlq7DbddxdHM+5vBRiPPSKi+OXpmw+lsdRfPq09Mr/ftODlh7orbm39cB3dhqt+A2/q00R+dnUmbxOtx5gfOejMpMLv/0gX1/fUXzya7NGb3y4QW40lFQVvZct9hRcya7f9S0r/vak8NyuhvjcMNkWmS0msUeBjpf8Trv/NCCT47m+tPDJQncnd1T1J3qaLO++UPJzfk5WtNKNk0yK9l6uFQG36jw35ztB37osdFMkrmKZpKMUzSTZJyimSTjFM0kGadoJsk4RTNJximaSTJO0UyScYpmkoxTNJNknKKZJONMj2YAwKWIZgCIQzQDQByiGQDiEM0AEIdoBoA4RDMAxCGaASAO0QwAcYhmAIhDNANAHKIZAOIQzQAQh2gGgDhEMwDEIZoBIA7RDABxiGYAiEM0A0AcohkA4hDNABCHaAaAOEQzAMQhmgEgDtEMAHGIZgCIQzQDQByiGQDi+B+UMgiP3XRpkQAAAABJRU5ErkJggg==" alt="" />

第四步:为了体现这一步遇到的问题,我把最后一个栏目多加了几个字,aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdEAAABqCAIAAABs2/zOAAAGqElEQVR4nO2cS47kOAwFdazaDzD3P8Vcohc5m5yaTEuiKFumn80IPBTyo3RRFB1djf6UFwAARFGuLgAAIBE4FwAgDpwLABAHzgUAiAPnAgDEgXMBAOLAuQAAceBcAIA4cC4AQBw4FwAgDpwLABAHzgUAiAPnAgDEgXMBAOLAuQAAceBcAIA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9kc49/m5j2U2c29vj9i5qffBzZel/cDip16Z59/Z6MvVYPM373OMCoznvt674u2L+zg8H0sD4oHPgp9uOc71HruRc45jrIy/V088Fpbra5t3mg+ZgiaR3hxjbdD4Wj71Buye9bb5fv4lzpz5lt8WYh6m5arzySOfa9D4yOAlJ55bvr57ha2621xxjvHpNuzyfPRlupzkYw4HRjJPeaVo9vOL/uOmdoB9Px+o+1B9svlImS/r/4490rv/d4dmcPnaz6f9zSc+sDPtj92r3pSJjn2k58Fg8fst4Fn8tCP8ztLC2TzVtzRWe59yzoupcQk4P/2f5wuBcb0TmQ6QMkio4d2Fwrjci8yFSBkkVnLswONcbkfkQKYOkCs5dGJzrjch8iJRBUgXnLgzO9UZkPkTKIKmCcxcG53ojMh8iZZBUwbkLg3O9EZkPkTJIquDchcG53ojMh0gZJFVw7sLgXG9E5kOkDJIqOHdhcK43IvMhUgZJFZy7MDjXG5H5ECmDpArOXZjLnHs7/vz8XF3C6yVTBqTipKljmHeDc+MQKQNSgXPVwLlxiJQBqcC5auDcOETKgFTgXDVwbhwiZUAqcK4aODcOkTIgFThXDZwbh0gZkAqcqwbOjUOkDEgFzlUD58YhUgakAueqgXPjECkDUoFz1cC5cYiUAanAuWrg3DhEyoBU4Fw1cG4cImVAKnCuGjg3DpEyIBU4Vw2cG4dIGZAKnKsGzo1DpAxIBc5VA+fGIVIGpALnqoFz4xApA1KBc9XAuXGIlAGpwLlq4Nw4RMqAVOBcNXBuHCJlQCpwrhpZnCuSqzsB6cC5aqRwLkBacK4aOBfgyfCbNjVwLgBAHDgXACAOnAsAEAfOBQCIA+cCAMSBcwEA4sC5AABx4FwAgDhwLgBAHDgXACAOnAsAEAfOBQCIA+cCAMSBcwEA4sC5AABx4FwAgDhwLgBAHDgXACAOnAsAEAfOBQCIA+cCAMTxLzQLCCcqdUmWAAAAAElFTkSuQmCC" alt="" /> 可以看出栏目之间的距离是不同的,为了寻找问题,我们给 li 设置一个宽度为 1px的 右外边距, margin-right:1px;aaarticl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M2IvT5s+bfkaezn/aMbDx7O///aX0kpqiXf3nT7JIUA7qc5gJ7GuPrj+qB3tqDTezNKa35va/vMDCFsvYpUcHFpk+LefLUNPb/Ph323HB1dUOI9z9mQJQTf6Ts/pZO2J+nwRL05vFs95qBeDdjgls13xf5zvVTZs2/I0+n/NYWmlKyOklsstJ57fkZ7vrFZNAuiQZ0OUHlPQmxHMPY//f93jIVD5fdP2kgrk1Zuzih+T44OD23982/Ik/XP93SPReP1pVeNrJZf/Ns9Dqg/Lxb7/73RR3/fVo61Q4P2NIyMww0D7ByyAM/hw3E1Spr730lIPii2PnT5n9xnt7ewjtj+SwFO1fvYqn+8/uEUt3t8mnzzeoxO5Wnw22tzcTvbePs3/fjK3FMnDdw+zCu71r96KArprqrceUVeRrT+8rQrHP48rT8fFX6qbnenp+gY3rezhhQ/Cjb2muPYdusjp15qtDbU1HjGQPxPuoo0moV9RebV8pkST8MPD9P9U+HrhM7aWoVwWavLKr3IIOfI3/fV9Y1+942Dv4+DeYMJ+86ArKBjQUsePPc4fl5+o6xOU1eMDCAAQyQpzaP6TVgAAMYSDdAnno8pteAAQxgIN0AeerxmF4DBjCAgXQD5KnHY3oNGMAABtINkKcej+k1YAADGEg3QJ56PKbXgAEMYCDdAHnq8ZheAwYwgIF0A+Spx2N6DRjAAAbSDZCnHo/pNWAAAxhIN0Ceejym14ABDGAg3QB56vGYXgMGMICBdAOePAUAgBjyFADAA3kKAOCBPAUA8ECeAgB4IE8BADyQpwAAHshTAAAP5CkAgAfyFADAA3kKAOCBPAUA8ECeAgB4IE8BADyQpwAAHshTAAAP5CkAgAfyFADAwz89F8nMZDuK2gAAAABJRU5ErkJggg==" alt="" />  这个时候就很清楚的发现问题了,由于给li设定了宽度,所以当文字多了以后,不能够自动伸缩适应,这时候就要去掉宽度。aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAARAAAABOCAIAAABnm95xAAAEhklEQVR4nO2YbW7cMAxEdbcAuf8p9hrtnyKxxQ9xbCeStu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aL3MMygT4XRsRo187HT3Z4naU+fJTDMoBDvSOF1UHXlTj5eNkW1EbUO1p/KUyf6SDr3JS9lmBxXpuj+98fgr/nm7ZCMiCtidD+ZhmZGrcWp3TmweZ37h6orVGa3P2f8GyavqI67eZ7IfdC908QjrWiYoTS5Lv7617//zHG/rYg7PFt+TmeBMUyyf7t2Hb9hkhTDxacF6Y/+umI3Qyrw7g5LGeanIu3rnPiFI71HitUCw0zTnRQ7BoaZpjspdgwMM013UuwYGGaa7qTYMTDMNN1JsWNgmGm6k2LHwDDTdCfFjoFhpulOih0Dw0zTnRQ7BoaZpjspdgwMM013UuwYGGaa7qTYMZYwDMB/AoYBEMAwAAIYBkAAwwAIYBgAAQwDIIBhAAQwDIAAhgEQwDAAAhgGQADDAAhgGACBv2iy+GpTmv+fAAAAAElFTkSuQmCC" alt="" /> 这个时候,宽度能够伸缩适应了,但是文字的空间太少,影响视觉,解决办法,添加所有内边距10px,给li 样式添加 padding:0 10px; 现在效果好多了aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXQAAAA9CAIAAAAyIQUUAAAFEklEQVR4nO2Ya44bIRCEuVuk3P8Ue43k38Yx9BsWD3ylljUZM1BV3VPypv0BAIAFaLsJAADOBOECAFgCwgUAsASECwBgCQgXAMASEC4AgCUgXAAAS0C4AACWgHABACyBGC6tfW59/fq9ncM9cqB3Un39+v1jRbjsrw+XA72TinCxDdrO4R450DupCBfboO0c7pEDvZOKcLEN2s7hHjnQO6kIF9ug7RzukQO9k4pwsQ3azuEeOdA7qQgX26DtHO6RA72TinCxDdrO4R450DupCBfboO0c7pEDvZOKcLEN2s7hHjnQO6meFS4teH+OQSsb0DOPamwhB7JyFjr8g25XFf2Iewlizkda4YhMPStchr4MnXLCZZCb2NvOynFKm3Ph4p2Y1OvhzK+SzxF60eYO7wdY1dxLnBVa7188nMC6vZpdnx8uIUzpbmKe+s41ecHbGo+cOdLir4eHwzSG7nBJ026RTdL0QoPqh/OUHKu0vZpdnx8upXk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mo8l1CHpUkr6cK5S3yV88xglq63Jx3/Ai11PeUfFeFoVTSW+1O705lA5Tiwrbb+cnaz8+ZtmeFGyVj0/evZsVmpnzCz1NrVV+NS3elyOTY7S+xHVUbPkls/brPsLS1NH1iok9V6YVXw6nczL52HFHp87rSMOnIPBOVnQVuezVl9Wf6e74/O9YZamMtzmd8uKUlXRVLqxFv+9UOfIij/ftaIFFYscXMtqDO10JNXZRFYP/oC31k90Vz6fkeapGVoVOe2xKt2pKCKd1YJpa9ayisDSJ1jgPRrGsRBIPaiuSDKleeH3f6tPM6tq8xjXUXYnDStQeUVT9WTjvVBqf890c6FcD4ZYUObQDf/If00BYQtidQhbEKtD2IJYHcIWxOoQtiBWh7AFsTqELYjVIWxBrA5hC2J1CFsQq0PYglgdwhbE6hC24MTqAICfB6wOQAtgdQBaAKsD0AJYHYAWwOoAtABWB6AFsDoALYDVAWgBrA5AC2B1AFrgL9fmTsdH+qjKAAAAAElFTkSuQmCC" alt="" />

第五步: 因为导航是需要点击的,我们需要放置 超链接(a标签),放在哪里呢,放在li标签内,操作如下,给li添加a标签,设置文字大小12px,规定鼠标移上去和移出的效果。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUwAAABaCAIAAABc9Pg6AAAD1UlEQVR4nO3VUY7bMAxF0eytQNc1q+022r9BEcm0Yothyp6Lh2ImzVgyxSs+fgNozaN6AwByITnQHJIDzSE50BySA80hOdAckgPNITnQHJIDzSE50BySA80hOdAckgPNITnQHJIDzSE50BySA80hOdAckgPNeUHyx0NEovz68fMDQ3KRbSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3+R2Sfz2+gk++Hl9x3nAM36s8bez0Rb4/3L7P4IF5Vbp2FqlndPrwldXXHzI99Jv9We7zmyZ5LE92xzwdyfSQRldfknz7hoMnL27s8rrxwY3Vq5U8LtSKlrHAKzWJU+5zruSv3oJJ7bJucrzPv39InaVHvx5V6c2Sj59srMNKzyz21cqlPBb8Qk3ilPv8pkkeV2T9FrjZu7Hk8Xkf3e55et9pxDuFimfa079jlbbs5Oi8VlaZXspHhT1637FngprEKfc5XfIVgQP5d/XKtFlXxlTcPRs3GZTrwncurz4uNC3RU7ni4Xm5Dke/Xnido1vp9DRXahKn3Od3SL54AOt/e/mwTyfD9Nqefm063zZudXsRXl396NbLljzw8GnAXh4e0xXjSR7XJE65zx83yTOG5KLDp+tOL4vtkseFevp87zyPpT1664wjWzyR0/O6037rNYlT7vPHTfIkyY9m71SV00t9/Nst+4ybbPrz3nLFz4wl33XZLZ5FXLRXqxqstVKTOOU+/6eTPGjKoFmDa2JXXm21DMnH942rN+5z45Edvdr6jXxat7iAKzWJU+7zR0zy8QC2mzM94PWe/vt/nzaZ19zjPt8s+cregv1klCL4ZnAvBFdVnJdqcpRynz9ikj8Gwaaf3G+XeBaN7XJ6tW+/lY5ulmkxp5/cXP206cdNHhVnYxZNC2oVqHt6ma7UJEi5z/WTPK7Uxun0JMb0+ad3zcrPN3d7NCSnK+7dw6sDc5RhSxHGgkwP5bJ40044ep3F+yVIuc/pkov85yn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3meQiuSn3+a7kAP5FSA40h+RAc0gONIfkQHNIDjSH5EBzSA40h+RAc0gONIfkQHNIDjSH5EBzSA40h+RAc0gONIfkQHNIDjSH5EBzSA40h+RAc0gONIfkQHNIDjSH5EBzSA40h+RAc0gONIfkQHNIDjTnD0/OSgxq/nGRAAAAAElFTkSuQmCC" alt="" />

第六步:如果希望鼠标移动上去显示 黑红色,给a 链接添加一个背景,以便看书a链接的区域。这里给a链接添加 黑色;aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAABDCAIAAACpyq8ZAAADUklEQVR4nO2WS46cQBAFuZsl3/8UXnIFezMLqPwVTRavkSP0NOqhGUi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gAAAABJRU5ErkJggg==" alt="" />,然后你发现,当你的鼠标移动到a标签后会出现小手的状态,为了用户体验,我们可以给 a 标签设置一个高度,让我们鼠标刚 接触li 标签就出现小手,添加height后,不管怎么刷新都不会出现,还是原来的样子,引发思考。因为 a 标签 是 内链元素,内链元素是无法设置宽度和高度的,我们需要使用 display:block; 将内链元素转换为块元素。这个时候会出现两种情况aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABBYAAADtCAIAAACEWmE0AAAgAElEQVR4nO3dTWwb553HcQI6EAhAy7EoQIUVkZZEcjgU32UOIRjIYYFFkENPaXNZB9git2aB5hoggbbYk5vs1YlPKZIAjl+SdW0nWTdx194Em2S7jbexnNZp7bxs0jTNS7vobmPzsHsYiRzO88xwhhzymYf6fjAIKIamHlE6PL95/v/nSfwfAAAAAASWUD0AAAAAADohQgAAAAAIgQgBAAAAIAQiBAAAAIAQiBAAAAAAQiBCAAAAAAiBCAEAAAAgBCIEAAAAgBCIEAAAAABCIEIAAAAACIEIAQAAACAEIgQAAACAEIgQAAAAAEIgQgAAAAAIgQgBAAAAIAQiBAAAAIAQiBAAAAAAQiBCAAAAAAhBQYT49K/+2udKAAAAAJgI/5m513yeCAEAAADsUkQIAAAAACEQIQAAAACEQIQAAAAAEAIRAgAAAEAIRAgAAAAAIRAhAAAAAIRAhAAAAAAQAhECAAAAQAhECAAAAAAhECEAAAAAhECEAAAAABACEQIAMEabiU2fZzYTm/7XBEcKAAiKCAEAGC9XZgj4SgBAbBEhAABjEXaFgfwAALogQgAAJsErIVDFBADaIUIAAMYlSDzwiRYTGSMAIDQiBABgXILEAyIEAGiHCAEAGJewqxDBG68BAAoRIQAA4xJ2FYIIAQBaIEIAAMaFVQgAmEpECADAuITqc7CfZC8mAIg/IgQAYFwCbtga5BkAQHwQIQAA4zJwFcI/KpAiACCeiBAAAAAAQiBCAAAAAAiBCAEAAAAgBCIEAAAAgBCIEAAAAABCIEIAAAAACIEIAQAAACAEIgQAAACAEIgQAAAAAE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OGDsnGeyx71LfwhFj5ySDPfZd6ls4YuycZLDHvkt9C0eMnZMM9th3qW/hiLFzksEe+y71LRwxdk4y2GPfpb6FI8bOSQZ77LvUt3DE2DnJYI99l/oWjhg7Jxnsse9S39rnCAD438ARAKDAEQCgwBEAoMARAKDAEQCgwBEAoMARAKDAEQCgwBEAoMARAKDAEQCgwBEAoMARVdwO83Wer/P8cTz7HgTAGBxR5n5crvPh9vjX6WOer4dT20EAhgFHFDnfllcpfM8RwUEAhgFHFDl9dHh30OUgAA7giAK35fEhwnWer8vxvun2x+P7cbnO8/OtxL9/Preco4MEu33p43aYr/Nye8rkfPzeWxuAXuCIIsESIHRE8Bnk/bg8m/x2eBohXEe87vYpgn/Pnm/Ll0dejgDgA44oUnDE9h3Edstn85/0QdY1+ETzqYzTYbOmAPAARxTZ44gvKbzsHDsi3G0NdPC5yvhY+AgD/MERRfY44nT4+txh81nDds94gRBaY/OOA8ARHFGkZR2ROUjNOmJZ+CoEfgI4okjD5xFVB1nX5OcRp9RyA8AcHFFklyO2X1is6/14uJ0Texa+13h82ck7DvAHRxTZ54h1+4cPue8+1/TfR3z+JcXLn2zz9xHgDY4AAAWOAAAFjgAABY4AAAWOAAAFjgAABY4AAAWOAAAFjgAABY4AAAWOAAAFjgAABY4AAAWOAAAFjgAABY4AAAWOAAAFjgAAxV+odCL8pjrMwQAAAABJRU5ErkJggg==" alt="" />,实际效果总是与期望效果不同,这个需要常年累积和对不同浏览器支持的了解。IE6 下面,认为a 标签既然转换为块元素,就要有块元素的特性,独占一行,再加上也没有对a标签的宽度设定,为什么firefox中没有这样呢,那时因为firefox 认为a标签即便是 块元素,也要受到它外面的li标签的影响。如何解决呢,因为现在a标签是块状元素了,所以给a标签添加 float:left; 即可。 现在两个浏览器显示的内容一样了

第七步:当我们鼠标移动到栏目上时,就会变成小手的形状,因为小手的形状是因为有a标签,但是我们发现a标签的宽度有点小,所以这里需要加宽a标签,这里使用 padding:0 10px; 因为之前有给 li 添加padding:0 10px; 为了能够更清晰的控制导航栏目的宽度,这里我们使用a标签来控制,去掉li 的padding。最后去掉a标签的背景,导航栏完成,兼容IE 以及常用浏览器哦。。。

最后的结果 aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbQAAAB0CAIAAABiyVARAAAFTElEQVR4nO3YYW7jNhSF0eytwKy0a8s2OD8CGI74SD5RCul4zsFFkDqOpMrOB7cfBYDKx+4LAHhF4ggQEEeAgDgCBMQRICCOAAFxBAiII0BAHAEC4ggQEEeAgDgCBMQRICCOAAFxBAiII0BAHAEC4ggQEEeAgDgCBMQRICCOAAFxBAiII0BAHAEC4ggQEEeAgDgCBMQRICCOAAFxBAiII0Dg1eP4+d+f7fv/4+Of2vYbbvYKE8fxttdKHM3WTxzH214rcTRbP3Ecb3utxNFs/cRxvO21Ekez9RPH8bbXShzN1k8cx9teK3E0Wz9xHG97rcTRbP3EcbzttRJHs/UTx/G210oczdZPHMfbXitxNFs/cRxve63E0Wz9xHG87bUSR7P1e4c41k97fuT6Ka7nppRy+ObwfeuRx4OHH4UPDg/1E3Hs3MDpFzRz0onX9K6zzx08c/b8QcL3/MX3uR32DnH8rGqYfGZymfY9HP6xfM9imY1jppitHNcXc1ccv25m65bWj0/c/IkjP67q8Ea66+zT76vOjcq8+ft/Jpl7Yqf2u+N49teHBwx39oNhaRewdZ39oj0/p/+0ic7OxfFwe5N3e+7+h2fvPFKqWJRGLi9ew/C9l3lO67YcHqxv+MQ9sVP73XEcvj8ej185/l1x/DrjsJv5D5j1ETofFevjzMXxcN9KO5H17T37gvZf6NYLGn4tVWtu/CsqVY4zZylVHDs3tvM2zt8TO7VfH8fM77aOkzn+59R/VrdSWD8yrF6JGposcnjAGz859l+suRc0efb6RIef1l/Db65fyeHUE0cOLz68n523buae2Km9QxyHj2ee09mVT46tJzwLn/b4UevrqcjWz7kex7mbecvqF7f1SPmxOIbvz1KlLfPeTl5M/ziZe2Kn9g5xHP5u5vvOJuL4rPP8TGTL6INh/wm1BZ8c68fPvqzDs7e++WzHceKln76wUz9tv4WPd7VzqMw9sVN7hzgOH89831kmjg+ttPX1q1caHxXL9yyG/7jlk2P9/cRtH549c8b+14vXcPatOzzp8K52zpW5J3Zq7xDH4e9mvu9s4pNj+IEuTFgd2eQROjWsfzE83U98ciyNP9GJ294/e30x4RkPXw/XeX31lZx9f/bfnOF1Zh7s/AlYcu8Qx/zjpf1/uzubi2OdpK/ztir5+Onja2kksnWW+jlrPjmW6u+8/mn4/On1j9A/V309N15M5sJKu6et+5b5M8nfE0vuHeKY+d3MI61d/+T4da5hPVuNe/x6Mnyl0dPb41ieali+/2EfXoizL+v0i/58/NKuxvVr6NyW4U8796q+b51fTx7nlnv+D+4d4th/vH+czCnyZSxVy0oVsv4jE9/XB+y39a441reuNP5ow0eurH+E/hmT76uJS6qPfPHt/XjO4cnhv07mntip/fo4Llg+K++x7Tfc7BUmjuNtr5U4mq2fOI63vVbiaLZ+4jje9lqJo9n6ieN422sljmbrJ47jba+VOJqtnziOt71W4mi2fuI43vZaiaPZ+onjeNtrJY5m6yeO422vlTiarZ84jre9VuJotn7iON72Womj2fqJ43jbayWOZusnjuNtr5U4mq2fOI63vVbiaLZ+rx5HgC3EESAgjgABcQQIiCNAQBwBAuIIEBBHgIA4AgTEESAgjgABcQQIiCNAQBwBAuIIEBBHgIA4AgTEESAgjgABcQQIiCNAQBwBAuIIEBBHgIA4AgTEESAgjgABcQQIiCNAQBwBAuIIEBBHgIA4AgTEESAgjgABcQQIiCNAQBwBAuIIEBBHgIA4AgTEESAgjgCBv/OWhrxIMonjAAAAAElFTkSuQmCC" alt="" />

这个导航可以延伸到不同的导航中,基本都差不多。重要的是,了解到一些元素在火狐和ie中的区别,更好的避免所谓的兼容性

最后 去除外面的div 后, 还是可以兼容浏览器的,很爽啊,上代码

<style type="text/css">
body,div,ul,li{padding:0px;margin:0px;}
ul{list-style:none;}
ul{width:1000px;margin:0 auto;background: #e64346;height:40px;margin-top: 100px;}
ul li{float:left;height: 40px;line-height: 40px;text-align: center;}
ul li a{font-size: 12px;text-decoration: none;height:40px;display: block;float: left;padding:0 10px;text-decoration: none;color:#fff;}
ul li a:hover{background: #a40000;}
</style>
<body>
<ul>
<li><a href="http://www.baidu.com">首页</a></li>
<li><a href="http://www.baidu.com">服装城你好</a></li>
<li><a href="http://www.baidu.com">食品</a></li>
<li><a href="http://www.baidu.com">团购</a></li>
<li><a href="http://www.baidu.com">夺宝岛集团</a></li>
</ul>
</body>

html通用导航条制作的更多相关文章

  1. HTML导航条的制作

    导航条的制作HTML代码:<nav> <ul> <li> <a href="#"></a> </li> &l ...

  2. 【转】一个DIV+CSS代码布局的简单导航条

    原文地址:http://www.divcss5.com/shili/s731.shtml 简单的DIV CSS代码布局实现导航条 一个蓝色主题的导航条布局案例,本CSS小实例,采用DIV CSS实现. ...

  3. 使用CSS3制作导航条和毛玻璃效果

    导航条对于每一个Web前端攻城狮来说并不陌生,但是毛玻璃可能会相对陌生一些.简单的说,毛玻璃其实就是让图片或者背景使用相应的方法进行模糊处理.这种效果对用户来说是十分具有视觉冲击力的. 本次分享的主题 ...

  4. css制作漂亮彩带导航条菜单

    点击这里查看效果:http://keleyi.com/keleyi/phtml/divcss/17.htm 效果图: 以下是源代码: <!DOCTYPE html PUBLIC "-/ ...

  5. CSS3+Js制作的一款响应式导航条

    今天制作了一个响应式导航条,能够自动随着不同的屏幕分辨率或浏览器窗口大小的不同而改变导航条的样式,这里主要用到的就是CSS3的Media Query.具体可以查看浅谈响应式布局这篇文章,这里就不花费大 ...

  6. 使用css3和伪元素制作的一个立体导航条

    使用css3和伪元素制作的一个立体导航条供大家参考,代码如下: <!doctype html> <html lang="en"> <head> ...

  7. 分针网—IT教育:使用CSS3制作导航条和毛玻璃效果

    导航条对于每一个Web前端攻城狮来说并不陌生,但是毛玻璃可能会相对陌生一些.简单的说,毛玻璃其实就是让图片或者背景使用相应的方法进行模糊处理.这种效果对用户来说是十分具有视觉冲击力的.本次分享的主题: ...

  8. HTML布局水平导航条1制作

    该文是用css制作个导航条,用竖线分隔,导航条是点击的多个区块.步骤:ul里设置需要数量的li,li中加上a链接给ul加样式,去掉默认的前面的点给li设置左浮动,让ul里的li横向排列a链接设置成块状 ...

  9. css 制作导航条布局

    代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8 ...

随机推荐

  1. Android 自定义组件随着手指自动画圆

    首先自定义一个View子类: package com.example.androidtest0.myView; import android.content.Context; import andro ...

  2. c#调用js,以及js调用C#里的函数, c#自己生成js代码,实现对web的控制

    using mshtml;using System;using System.Collections.Generic;using System.Linq;using System.Security.P ...

  3. bzoj1179

    这种tarjan+dp的水题我竟然还WA了两次,要小心! type link=^node;      node=record        po:longint;        next:link; ...

  4. POJ_2229_Sumsets_(动态规划)

    描述 http://poj.org/problem?id=2229 将一个数n分解为2的幂之和共有几种分法? Sumsets Time Limit: 2000MS   Memory Limit: 20 ...

  5. jackson 常见问题

    org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type   org.codehaus ...

  6. 滚动轮播插件——jCarouselLite

    jcarousellite(上下.水平滚动元素插件)插件使用: 参数说明: btnPrev     string 上一个按钮的class名, 比如  btnPrev: ".prev" ...

  7. SQL Server数据库存在判断语句及系统表简介 转

    Transact-SQL Exists Sentences--判断数据库是否存在IF EXISTS(SELECT * FROM master.sysdatabases WHERE name=N'库名' ...

  8. How many ways

    How many ways Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot ...

  9. selenium-webdriver的等待方法

    Wait commands in WebDriver Listing out the different WebDriver Wait statements that can be useful fo ...

  10. Ubuntu安装secureCRT

    在使用secureCRT前确保主机的ssh服务是启动状态. 一.下载secureCRT包 site:  https://www.vandyke.com/download/securecrt/downl ...