Home Web Front-end CSS Tutorial DIV and CSS realize the effect of imitating the navigation bar of Jingdong Mall

DIV and CSS realize the effect of imitating the navigation bar of Jingdong Mall

Jun 11, 2018 pm 04:00 PM
css div Navigation bar

This article mainly introduces p CSS to realize the imitation Jingdong Mall navigation bar effect, involving page p css layout and related techniques of dynamic switching combined with onmouseout mouse events. It has certain reference value. Friends in need can refer to it

The example in this article describes how p CSS realizes the effect of imitating the navigation bar of Jingdong Mall. Share it with everyone for your reference. The details are as follows:

Here is a demonstration of the p CSS function code that imitates the navigation bar of Jingdong Mall. When the mouse slides over the navigation bar option, the corresponding submenu list will pop up. The interface is simple and elegant.

The screenshot of the running effect is as follows:

The specific code is as follows:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

<!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>

<meta http-equiv="Content-Type" content="text/html; charset=utf8" />

<title>京东商城导航条</title>

<style type="text/css">

.my_left_category{

    width:150px;

    font-size:12px;

    font-family:arial,sans-serif;

    letter-spacing:2px;

}

.my_left_category h1{

    background-image:url(images/spring_06.gif);

    height:20px;

    background-repeat:no-repeat;

    font-size:14px;

    font-weight:bold;

    padding-left:15px;

    padding-top:8px;

    margin:0px;

    color:#FFF;

}

.my_left_category .my_left_cat_list{

width:148px;

border-color:#b60134;

border-style:solid;

border-width:0px 1px 1px 1px;

line-height:13.5pt;

}

.my_left_category .my_left_cat_list h2 {

margin:0px;

padding:3px 5px 0px 9px;

}

.my_left_category .my_left_cat_list h2 a {

color:#d6290b;

font-weight:bold;

font-size:14px;

line-height:22px;

}

.my_left_category .my_left_cat_list h2 a:hover {

color:#d6290b;

font-weight:bold;

font-size:14px;

line-height:22px;

}

.my_left_category .h2_cat{

  width:148px;

  height:26px;

  background-image:url(images/my_menubg.gif);

  background-repeat:no-repeat;

  line-height:26px;

  font-weight:normal;

  color:#333333;

  position:relative;

}

.my_left_category .h2_cat_1{

  width:148px;

  height:26px;

  background-image:url(images/my_menubg_1.gif);

  background-repeat:no-repeat;

  line-height:26px;

  font-weight:normal;

  color:#333333;

  position:relative;

}

.my_left_category a{

  font:12px;

  text-decoration:none;

  color:#333333;

}

.my_left_category a:hover{

  text-decoration:underline;

  color:#ff3333;

}

.my_left_category h3{

margin:0px;

padding:0px;

height:26px;

font-size:12px;

font-weight:normal;

display:block;

padding-left:8px;

}

.my_left_category h3 span{color:#999999; width:145px; float:right;}

.my_left_category h3 a{  line-height:26px;}

.my_left_category .h3_cat{

 display:none;

 width:204px;

 position:absolute;

 left:123px;

 margin-top:-26px;

 cursor:auto;

}

.my_left_category .shadow{

position:inherit;

background:url(images/shadow_04.gif) left top;

width:204px;

}

.my_left_category .shadow_border{

position:inherit;

width:200px;

border:1px solid #959595; margin-top:1px;

border-left-width:0px;

background:url(images/shadow_border.gif) no-repeat 0px 21px;

background-color:#ffffff;

margin-bottom:3px

}

.my_left_category .shadow_border ul{margin:0; padding:0; margin-left:15px}

.my_left_category .shadow_border ul li {

list-style:none;

padding-left:10px;

background-image:url(images/my_cat_sub_menu_dot.gif);

background-repeat:no-repeat;

background-position:0px 8px;

float:left;

width:75px;

height:26px;

overflow:hidden;

letter-spacing:0px;

}

.my_left_category .active_cat{ z-index:99;background-position:0 -25px;cursor:pointer;}

.my_left_category .active_cat h3 { font-weight:bold}

.my_left_category .active_cat h3 span{ display:none;}

.my_left_category .active_cat p{display:block;}

</style>

</head>

<body>

<p class="my_left_category">

  <h1>分类导航</h1>

  <p class="my_left_cat_list">

    <h2><a href="#">按网站类别</a></h2>

    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">

      <h3><a href="#">企业建站</a></h3>

      <p class="h3_cat">

         <p class="shadow">

          <p class="shadow_border">

            <ul>

             <li><a href="#">LOGO设计</a></li>

             <li><a href="#">网站设计</a></li>

             <li><a href="#">网站广告</a></li>

             <li><a href="#">推广</a></li>

             <li><a href="#">建网站</a></li>

             <li><a href="#">网站推广</a></li>

             <li><a href="#">网站建设</a></li>

             <li><a href="#">SEO</a></li>

            </ul>

          </p>

         </p>

      </p>   

    </p>

    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">

      <h3><a href="#">韩国男装</a></h3>

      <p class="h3_cat">

        <p class="shadow">

          <p class="shadow_border">

            <ul>

             <li><a href="#">LOGO设计</a></li>

             <li><a href="#">网站设计</a></li>

             <li><a href="#">网站广告</a></li>

             <li><a href="#">推广</a></li>

             <li><a href="#">建网站</a></li>

             <li><a href="#">网站推广</a></li>

             <li><a href="#">网站建设</a></li>

             <li><a href="#">SEO</a></li>

            </ul>

          </p>

        </p> 

      </p>   

    </p>

    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">

      <h3><a href="#">脚本之家</a></h3>

      <p class="h3_cat">

        <p class="shadow">

          <p class="shadow_border">

            <ul>

             <li><a href="#">LOGO设计</a></li>

             <li><a href="#">源码下载</a></li>

             <li><a href="#">最新更新</a></li>

             <li><a href="#">下载排行</a></li>

             <li><a href="#">ASP</a></li>

             <li><a href="#">PHP</a></li>

             <li><a href="#">AJAX</a></li>

             <li><a href="#">DELPHI</a></li>

            </ul>

          </p>

        </p> 

      </p>   

    </p>

<!-- again -->

    <h2><a href="#">按品牌选货</a></h2>

    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">

      <h3><a href="#" style="color:#ff3333;">热销推荐</a></h3>

      <p class="h3_cat">

         <p class="shadow">

          <p class="shadow_border">

            <ul>

             <li><a href="#">LOGO设计</a></li>

             <li><a href="#">网站设计</a></li>

             <li><a href="#">网站广告</a></li>

             <li><a href="#">推广</a></li>

             <li><a href="#">建网站</a></li>

             <li><a href="#">网站推广</a></li>

             <li><a href="#">网站建设</a></li>

             <li><a href="#">SEO</a></li>

            </ul>

          </p>

         </p>

      </p>   

    </p>

    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">

      <h3><a href="#">网站建设</a></h3>

      <p class="h3_cat">

        <p class="shadow">

          <p class="shadow_border">

            <ul>

             <li><a href="#">LOGO设计</a></li>

             <li><a href="#">网站设计</a></li>

             <li><a href="#">推广</a></li>

             <li><a href="#">建网站</a></li>

             <li><a href="#">网站推广</a></li>

             <li><a href="#">推广</a></li>

             <li><a href="#">LOGO设计</a></li>

             <li><a href="#">网站设计</a></li>

             <li><a href="#">网站广告</a></li>

             <li><a href="#">推广</a></li>

             <li><a href="#">建网站</a></li>

             <li><a href="#">网站推广</a></li>

             <li><a href="#">网站建设</a></li>

             <li><a href="#">LOGO设计</a></li>

             <li><a href="#">网站设计</a></li>

             <li><a href="#">网站建设</a></li>

             <li><a href="#">SEO</a></li>

            </ul>

          </p>

        </p> 

      </p>   

    </p>

    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">

      <h3><a href="#">网站程序</a></h3>

      <p class="h3_cat">

        <p class="shadow">

          <p class="shadow_border">

            <ul>

             <li><a href="#">PHP</a></li>

             <li><a href="#">ASP</a></li>

             <li><a href="#">JSP</a></li>

             <li><a href="#">ASP.Net</a></li>

            </ul>

          </p>

        </p> 

      </p>   

    </p>

    <p class="h2_cat_1" onmouseover="this.className=&#39;h2_cat_1 active_cat&#39;" onmouseout="this.className=&#39;h2_cat_1&#39;">

      <h3><a href="#">其他网站</a></h3>

    </p>

  <!-- again -->

    <h2><a href="#">按价格选货</a></h2>

    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">

      <h3><a href="#">低端价位</a></h3>

      <p class="h3_cat">

         <p class="shadow">

          <p class="shadow_border">

            <ul>

             <li><a href="#">50元以下</a></li>

             <li><a href="#">50-100元</a></li>

            </ul>

          </p>

         </p>

      </p>   

    </p>

    <p class="h2_cat" onmouseover="this.className=&#39;h2_cat active_cat&#39;" onmouseout="this.className=&#39;h2_cat&#39;">

      <h3><a href="#">中高端价位</a></h3>

      <p class="h3_cat">

        <p class="shadow">

          <p class="shadow_border">

            <ul>

             <li><a href="#">100-150元</a></li>

             <li><a href="#">150-200元</a></li>

             <li><a href="#">200-300元</a></li>

             <li><a href="#">300元以上</a></li>

             </ul>

          </p>

        </p> 

      </p>   

    </p>

      <!-- again -->

    <h2><a href="#">超值特价区</a></h2>

    <h2><a href="#">现货区</a></h2>

<!--测试复制end-->   

 </p>

 </p>

</body>

</html>

Copy after login

The above is the entire content of this article, I hope it will be useful for everyone's learning For help, please pay attention to the PHP Chinese website for more related content!

Related recommendations:

How to use CSS to achieve a black navigation menu effect with shadow effect

CSS3 area Relevant code of module region

The above is the detailed content of DIV and CSS realize the effect of imitating the navigation bar of Jingdong Mall. For more information, please follow other related articles on the PHP Chinese website!

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 AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

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)

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

How to use bootstrap in vue How to use bootstrap in vue Apr 07, 2025 pm 11:33 PM

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

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

How to use bootstrap button How to use bootstrap button Apr 07, 2025 pm 03:09 PM

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

See all articles