html 纵向选项卡,竖直选项卡式面板的实现_html/css_WEB-ITnose
前面的話:
我是html的初學者,懂得一些html的基本知識。最近開始學css,不會JavaScript。了解到adobe dw cs5的插入->spry有選項卡式面板的設計,對這個很感興趣。但是發現默認的是tab水平排列在上面的。然而多數網站都是tab豎直排列在網頁的左端。于是開始尋找修改spry插入的選項卡面板,以適應需求。
考慮到spry默認生成的選項卡式面板網頁里已經包含了垂直的樣式,但是大框架雖然有,直接運行則很不好看,因為只有tab豎直排列了,而內容在tab的下邊而不是右側。
實踐:
新建文件,并插入spry選項卡式面板后,dw將生成三個文件:name.html(是主文件,文件名隨意),SpryTabbedPanels.css,SpryTabbedPanels.js。在這里我們只修改name.html和SpryTabbedPanels.css,而js文件不動(因為我不會js,慚愧...)
在name.html中,只在選項卡面板的div前再套一層div,
...,這層div完全是配合spry本身提供的豎直排列功能的,因此class的名字最好不要改。在本文件中修改的其他部分就是網頁的內容了,沒有其他標簽了(至多添加一個無關痛癢的
標簽,如果內容段落多的話)。于是name.html的代碼如下:無標題文檔
Beijing
Shanghai
Tianjin
Beijing, also known as Peking, is a metropolis in northern China, and the capital of the People's Republic of China. Governed as a municipality under direct administration of the central government, Beijing borders Hebei Province to the north, west, south, and for a small section in the east, and Tianjin Municipality to the southeast. Beijing is one of the Four Great Ancient Capitals of China.
Beijing is divided into 16 urban and suburban districts and two rural counties. Beijing is a major transportation hub, with dozens of railways, roads and motorways passing through the city. It is also the destination of many international flights arriving in China. Beijing is recognized as the political, educational, and cultural center of the People's Republic of China, while Shanghai and Hong Kong predominate in economic fields. The city hosted the 2008 Olympic Games.
Few cities in the world besides Beijing have served as the political and cultural centre of an area as immense as China for so long. The Encyclop?dia Britannica describes it as "one of the world's great cities," and declares that the city has been an integral part of China's history for centuries; there is scarcely a major building of any age in Beijing that doesn't have at least some national historical significance. Beijing is renowned for its opulent palaces, temples, and huge stone walls and gates. Its art treasures and universities have long made the city a centre of culture and art in China.
Shanghai is the most populous city in the People's Republic of China, which is the 10th most populous metropolitan areas in the world. A global city, Shanghai exerts influence over global commerce, finance, culture, art, fashion, research and entertainment. The city is located at the middle part of the coast of mainland China, it sits at the mouth of the Yangtze.
Originally a fishing and textiles town, Shanghai grew to importance in the 19th century due to its favorable port location and as one of the cities opened to foreign trade by the 1842 Treaty of Nanking. The city flourished as a center of commerce between east and west, and became a multinational hub of finance and business by the 1930s. After 1990, the economic reforms introduced by Deng Xiaoping resulted in intense re-development and financing in Shanghai, and in 2005 Shanghai became the world's largest cargo port.
The city is a tourist destination renowned for its historical landmarks such as the Bund and City God Temple, and its modern and ever-expanding Pudong skyline including the Oriental Pearl Tower. Today, Shanghai is the largest center of commerce and finance in mainland China, and has been described as the "showpiece" of the world's fastest-growing major economy.
Tianjin is a metropolis in Northeastern China and one of the five national central cities. It is governed as a direct-controlled municipality, one of four such designations, and is thus under direct administration of the central government, and borders Hebei Province and Beijing Municipality, bounded to the east by the Bohai Gulf portion of the Yellow Sea. In terms of urban population, it is the sixth largest city of the People's Republic of China, and its urban land area ranks 5th in the nation, only after Beijing, Shanghai, Guangzhou, and Shenzhen.
Tianjin's urban area is located along the Hai He River, which connects to the Yellow and Yangtze Rivers via the Grand Canal in Tianjin. Its ports, some distance away, are located on the Bohai Gulf in the Pacific Ocean. Tianjin was once home to foreign concessions in the late Qing Dynasty and early Kuomintang (KMT) era. The municipality incorporates the coastal region of Tanggu, home to the Binhai New Area and the Tianjin Economic-Technological Development Area (TEDA). Tianjin Municipality borders Hebei province to the north, south, and west; the Chinese capital Beijing is to the northwest, and the Bohai Gulf to the east.
SpryTabbedPanels.css的內容,因為英語不好,所以把它原本提供的英文注釋都刪了,此外,還把不屬于.VTabbedPanels的子類的類刪了,這樣代碼看起來清爽了很多。如下:
@charset "UTF-8";.VTabbedPanels #TabbedPanels1.TabbedPanels{margin:0px;padding:0px;border:0px;width:403px;height:auto;}.VTabbedPanels .TabbedPanelsTabGroup {/*這里設置tab組的樣式*/margin: 0px;padding: 0px;border:0px;/*display:block;*/float: left;width: 100px;height: auto;/*position: relative;*/}.VTabbedPanels .TabbedPanelsTab {/*這里設置tab的樣式*//*position: relative;/*display:block;*//*float: none;*/margin:5px 0px 1px 0px;top: 1px;padding: 4px 10px;font: bold;font-family:Arial;background-color: #090;color:#dfe;list-style: none;border-top: solid 3px #060;border-left: solid 3px #060;border-right: solid 3px #090;border-bottom: solid 3px #060;-moz-user-select: none;-khtml-user-select: none;cursor: pointer;}.VTabbedPanels .TabbedPanelsTabHover {/*這里設置鼠標經過*/background-color: #aeb;color:#090;}.VTabbedPanels .TabbedPanelsTabSelected {/*這里設置選中的tab的樣式*/background-color: #dfe;border-right: solid 3px #dfe;color:#090;}.VTabbedPanels .TabbedPanelsContentGroup {/*這里是內容框的樣式*//*clear:none;*/border-left: solid 3px #090;border-bottom: solid 3px #090;border-top: solid 3px #090;border-right: solid 3px #090;background-color: #dfe;color:#090;padding: 0px;margin:0 0 0 97px;/*97px是計算得到的,這樣就能實現tab和內容連通的效果了。*/width: 300px;height: 350px;font-size:11px;font-family:Arial;}.VTabbedPanels .TabbedPanelsContentGroup p {margin:5px;padding:0px;}
js文件的代碼較長,但是里面一句也沒有修改。由于帖子長度有限制,就不貼在這里了。
回復討論(解決方案)
接分的來了
不錯咯~~~
向LZ學習
謝謝分享
一般是自己寫代碼的
有水平樣式的嗎。發我:lion_6@163.com
不妥啊~代碼原封不懂拿過來~在瀏覽器上不出效果~
挺不錯的,分享!
聲明:本文原創發布php中文網,轉載請注明出處,感謝您的尊重!如有疑問,請聯系admin@php.cn處理
總結
以上是生活随笔為你收集整理的html 纵向选项卡,竖直选项卡式面板的实现_html/css_WEB-ITnose的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: GIT更新失败
- 下一篇: Java集合迭代器原理图解_Java I