div+css布局实现简洁横向时间轴代码
代码语言:html
所属分类:布局界面
代码描述:div+css布局实现简洁横向时间轴代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Timeline</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
background-color: #f8f9fa;
margin: 0;
padding: 60px 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
box-sizing: border-box;
overflow-x: hidden; /* Prevent horizontal scroll from body */
}
.timeline-container {
position: relative;
width: 100%;
max-width: 1000px; /* Adjust as needed */
margin: 0 auto;
padding: 50px 0;
}
.timeline-line {
position: absolute;
left: 0;
right: 0;
top: 50%;
transform: translateY(-50%);
height: 4px;
background-color: #0052d9; /* Blue line */
z-index: 1;
}
.timeline-events {
display: flex;
justify-content: space-between; /* Distribute events along the line */
position: relative;
z-index: 2;
}
.timeline-event {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 20%; /* Approximate width for 5 items, adjust based on number */
}
.timeline-event .marker {
width: 16px;
height: 16px;
background-color: #0052d9;
border: 3px solid #fff; /* White border to lift it above line */
border-radius: 50%;
z-index: 3;
position: relative; /* To position above/below cards relative to this */
}
.timeline-.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0