> 웹 프론트엔드 > CSS 튜토리얼 > HTML5와 CSS3를 사용하여 생일 케이크 만들기

HTML5와 CSS3를 사용하여 생일 케이크 만들기

不言
풀어 주다: 2018-06-20 09:50:34
원래의
3860명이 탐색했습니다.

이 글은 주로 HTML5와 CSS3를 사용하여 생일 케이크를 만드는 방법을 소개합니다. 이제 모든 사람과 공유합니다. 도움이 필요한 친구들이 참고할 수 있습니다

"생일 축하합니다.. "생일에는 생일 노래도 포함되어 있고 생일 케이크도 빼놓을 수 없습니다. 이 글에서는 주로 프로그래머들이 순수한 HTML5+CSS3을 사용하여 만든 생일 케이크를 자세히 소개합니다. 참고할만한 가치가 있습니다. 관심 있는 친구들은 참고할 수 있습니다

프론트엔드 개발자로서 , 오늘의 좋은 날을 축하하기 위해 간단한 케이크를 그려보자. 프로그래머의 생일의 즐거움과 슬픔. 글은 비교적 간단하니 관심 있으신 분들은 한번 보세요.

렌더링 먼저 보내드려요

케이크는 하단 케이크, 상단 케이크, 캔들 부분 세 부분으로 나누어져 있어요. HTML의 레이아웃 구조도 이 세 부분에 따라 구성됩니다. 다른 하나는 CSS 위치 지정과 CSS3 회전, 내부 및 외부 그림자 및 기타 효과를 사용하여 일부 DOM 요소의 스타일을 조정하는 것입니다. 비교적 간단합니다. 모든 코더가 이를 이해한다고 믿습니다.

다른 내용에 대해서는 자세히 설명하지 않겠습니다.

전체 HTML 코드와 CSS 코드는 아래에 나와 있습니다.

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

<!DOCTYPE html>

<html>

<head lang="en">

    <meta charset="UTF-8">

    <title></title>

    <style>

        .birthday .container{

            width:600px;

            height:600px;

            margin:0px auto;

            background: #fafafa;

            border-radius:5px;

            position: relative;

        }

 

        /**

       ** 顶层的

       **/

 

        .birthday .top-one{

            position: absolute;

            width:280px;

            height: 280px;

            bottom: 200px;

            left:160px;

        }

 

        .birthday .top-one .bottom{

            position: absolute;

            width:280px;

            height: 280px;

            bottom:-30px;

            border:1px solid #3e2001;

            border-radius: 140px;

            transform: rotateX(60deg);

            z-index: 4;

            background: #3e2001;

            box-shadow: 0px 0px 20px #3e2001;

        }

        .birthday .top-one .top{

            position: absolute;

            width:280px;

            height: 280px;

            top:-50px;

            border-radius: 140px;

            background: #FFFFFF;

            transform: rotateX(60deg);

            box-shadow: 2px 2px 20px #b7b7b7;

            z-index: 6;

            background: -webkit-repeating-radial-gradient(circle, #783d01, #3e2001 10px, #914909 10px,white 20px);

            background: -moz-repeating-radial-gradient(circle, #783d01, #3e2001 10px,#914909 10px,white 20px);

        }

        .birthday .top-one .side{

            position: absolute;

            top:95px;

            width:280px;

            height: 70px;

            border:1px solid #3e2001;

            border-top-width: 0px;

            border-bottom-width: 0px;

            background: #FFFFFF;

            z-index: 5;

            background: #3e2001;

        }

 

 

        /**

        ** 底层的

        **/

        .birthday .bottom-one{

            position: absolute;

            width:400px;

            height: 400px;

            bottom: 0px;

            left:100px;

        }

        .birthday .bottom-one .bottom{

            position: absolute;

            width:400px;

            height: 400px;

            bottom:-30px;

            border:1px solid #914909;

            border-radius: 200px;

            transform: rotateX(60deg);

            box-shadow: 2px 2px 20px #914909;

            z-index: 1;

            background: #3e2001;

            overflow: hidden;

        }

        .birthday .bottom-one .line{

            position: absolute;

            width:400px;

            height: 400px;

            border-radius: 200px;

            z-index: 1;

        }

        .birthday .bottom-one .line1{

            bottom: 30px;

            border:5px solid #783d01;

            left:-5px;

            z-index: 1;

        }

 

        .birthday .bottom-one .top{

            position: absolute;

            width:400px;

            height: 400px;

            top:-100px;

            border:1px solid #3e2001;

            border-radius: 200px;

            background: #FFFFFF;

            transform: rotateX(60deg);

            z-index: 3;

            background: #783d01;

            box-shadow: inset 0px 0px 20px #3e2001;

 

        }

 

        .birthday .bottom-one .side{

            position: absolute;

            top:100px;

            width:400px;

            height: 130px;

            border:1px solid #3e2001;

            border-top-width: 0px;

            border-bottom-width: 0px;

            background: #3e2001;

            z-index: 2;

 

        }

 

 

        /**

        ** 底层的文字

        **/

        .birthday .flower{

            position: relative;

            text-align: justify;

            z-index: 9;

            top:200px;

            font-size: 32px;

            font-family: "Helvetica Neue", "Noto Sans CJK SC", "Source Han Sans CN";

            color:#FFFFFF;

            font-weight: bold;

        }

        .birthday .flower:after{

            content:"";

            display:inline-block;

            position: relative;

            width:100%;

        }

 

        .birthday .flower i{

            position: relative;

            width:80px;

            line-height: 80px;

            display: inline-block;

            border-radius: 50%;

            border:2px solid #783d01;

            text-align: center;

 

        }

 

        /**

        ** 顶层的文字

        **/

        .birthday .top-one .text{

            width:100%;

            text-align: center;

            position: absolute;

            top:165px;

            z-index: 9;

            margin:0px auto;

            font-size: 30px;

            color:#FFFFFF;

            transform: rotateX(60deg) skew(10deg,20deg);

        }

 

 

        /**

         ** 蜡烛

        **/

 

        .birthday .candle{

            width:10px;

            height:80px;

            margin:0px auto;

            position: absolute;

            left:295px;

            top:130px;

            z-index: 9;

        }

        .birthday .candle .body{

            width:10px;

            height:70px;

            margin:0px auto;

            background: red;

            border-bottom-width: 0px;

        }

 

        .birthday .candle .top{

            width:10px;

            height: 10px;

            border-radius: 5px;

            transform: rotateX(60deg);

            position: relative;

            top:5px;

            background: red;

        }

        .birthday .candle .bottom{

            width:10px;

            height: 10px;

            border-radius: 5px;

            transform: rotateX(60deg);

            position: relative;

            bottom:5px;

            background: red;

            box-shadow: 1px 1px 10px red;

        }

 

        .birthday .candle .fire{

            position: absolute;

            width:6px;

            height: 6px;

            left:2px;

            transform: rotate(45deg);

            background: #ffd507;

            box-shadow: 0px 0px 20px #ffff00, 2px 2px 10px red;

 

        }

 

 

    </style>

 

</head>

<body>

    <p class="birthday">

        <p class="container">

 

            <p class="candle">

                <p class="fire"></p>

                <p class="top"></p>

                <p class="body"></p>

                <p class="bottom"></p>

            </p>

 

            <p class="top-one">

                <p class="top"></p>

                <p class="side"></p>

                <p class="bottom"></p>

                <p class="text">

                    Happy Birthday

                </p>

            </p>

 

            <p class="bottom-one">

                <p class="top"></p>

                <p class="side"></p>

                <p class="bottom">

                    <p class="line line1"></p>

                </p>

                <p class="flower">

                    <i style="top:-20px;transform: rotateY(50deg)">生</i>

                    <i style="top:15px;transform: rotateY(30deg)">日</i>

                    <i style="top:15px;transform: rotateY(30deg)">快</i>

                    <i style="top:-20px;transform: rotateY(50deg)">乐</i>

                </p>

            </p>

        </p>

    </p>

</body>

</html>

로그인 후 복사

좋습니다. 나중에는 Canvas 캔버스나 SVG를 사용하여 시도해 볼 수 있습니다. 읽어주셔서 감사합니다.

위 내용은 이 글의 전체 내용입니다. 모든 분들의 학습에 도움이 되었으면 좋겠습니다. 더 많은 관련 내용은 PHP 중국어 홈페이지를 주목해주세요!

관련 권장 사항:

jQuery와 HTML5를 사용하여 휴대폰을 흔들어 옷을 갈아입는 특수 효과를 구현하는 방법

63줄의 HTML5 코드를 사용하여 스네이크 게임 구현

위 내용은 HTML5와 CSS3를 사용하여 생일 케이크 만들기의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

관련 라벨:
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿