Table of Contents
Reply to the discussion (solution)
Home Web Front-end HTML Tutorial Implementation of vertical tabbed panel_html/css_WEB-ITnose

Implementation of vertical tabbed panel_html/css_WEB-ITnose

Jun 24, 2016 pm 12:14 PM

Previous words:
I am a beginner in html and know some basic knowledge of html. I recently started learning CSS, but I don’t know JavaScript. I learned that adobe dw cs5 plug-in->spry has a tabbed panel design, and I am very interested in this. But I found that the default is for tabs to be arranged horizontally on top. However, most websites have tabs arranged vertically at the left end of the web page. So I started looking to modify the tab panel inserted by spry to meet the needs.

Considering that the tabbed panel webpage generated by spry by default already contains vertical styles, but although there is a large frame, it will not look good if you run it directly, because only the tabs are arranged vertically, and the content is in the tabs. the bottom side instead of the right side.

Practice:

After creating a new file and inserting the spry tabbed panel, dw will generate three files: name.html (the main file, the file name is arbitrary), SpryTabbedPanels.css, SpryTabbedPanels.js. Here we only modify name.html and SpryTabbedPanels.css, leaving the js file unchanged (because I don’t know js, I’m ashamed...)

In name.html, only in front of the div of the tab panel Add another layer of div, <div class="VTabbedPanels">...</div>. This layer of div is completely compatible with the vertical arrangement function provided by spry itself, so it is best not to change the name of the class. The other parts modified in this file are the content of the web page, and there are no other tags (at most, add an insignificant <p> tag, if there are many paragraphs of content). So the code of name.html is as follows:

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;head&gt;&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;&lt;title&gt;无标题文档&lt;/title&gt;&lt;script src=&quot;SpryAssets/SpryTabbedPanels.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&lt;link href=&quot;SpryAssets/SpryTabbedPanels.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;&lt;/head&gt;&lt;body&gt;&lt;div class=&quot;VTabbedPanels&quot;&gt;&lt;div id=&quot;TabbedPanels1&quot; class=&quot;TabbedPanels&quot;&gt;  &lt;ul class=&quot;TabbedPanelsTabGroup&quot;&gt;    &lt;li class=&quot;TabbedPanelsTab&quot; tabindex=&quot;0&quot;&gt;Beijing&lt;/li&gt;    &lt;li class=&quot;TabbedPanelsTab&quot; tabindex=&quot;0&quot;&gt;Shanghai&lt;/li&gt;    &lt;li class=&quot;TabbedPanelsTab&quot; tabindex=&quot;0&quot;&gt;Tianjin&lt;/li&gt;  &lt;/ul&gt;  &lt;div class=&quot;TabbedPanelsContentGroup&quot;&gt;    &lt;div class=&quot;TabbedPanelsContent&quot;&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;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&aelig;dia Britannica describes it as &quot;one of the world's great cities,&quot; 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.&lt;/p&gt;&lt;/div&gt;    &lt;div class=&quot;TabbedPanelsContent&quot;&gt;    &lt;p&gt;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.&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;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 &quot;showpiece&quot; of the world's fastest-growing major economy.&lt;/p&gt;&lt;/div&gt;    &lt;div class=&quot;TabbedPanelsContent&quot;&gt;    &lt;p&gt;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.&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;    &lt;/div&gt;  &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;script type=&quot;text/javascript&quot;&gt;var TabbedPanels1 = new Spry.Widget.TabbedPanels(&quot;TabbedPanels1&quot;);&lt;/script&gt;&lt;/body&gt;&lt;/html&gt;
Copy after login


The content of SpryTabbedPanels.css, because the English is not good, has been deleted. The subclasses of VTabbedPanels have been deleted, so the code looks much cleaner. As follows:



@charset &quot;UTF-8&quot;;.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;}
Copy after login



The code of the js file is longer, but not a single sentence in it has been modified. Since there is a limit on the length of the post, I won’t post it here.


Reply to the discussion (solution)

Here comes the answer

Not bad~~~

Learn from LZ

Thanks for sharing

I usually write the code myself

Is there any horizontal style? Send it to me: lion_6@163.com

That’s not right~ I don’t understand the original code and bring it over~ It doesn’t work on the browser~

It’s pretty good, share it!

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)

Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update? Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update? Mar 04, 2025 pm 12:32 PM

Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?

How do I use HTML5 form validation attributes to validate user input? How do I use HTML5 form validation attributes to validate user input? Mar 17, 2025 pm 12:27 PM

How do I use HTML5 form validation attributes to validate user input?

What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

What is the purpose of the <iframe> tag? What are the security considerations when using it?

How to efficiently add stroke effects to PNG images on web pages? How to efficiently add stroke effects to PNG images on web pages? Mar 04, 2025 pm 02:39 PM

How to efficiently add stroke effects to PNG images on web pages?

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

What is the purpose of the <meter> element?

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

What is the purpose of the <datalist> element?

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

What is the viewport meta tag? Why is it important for responsive design?

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

What is the purpose of the <progress> element?

See all articles