带前缀后缀输入框
代码语言:html
所属分类:表单美化
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title> - Input Prefix and Suffix</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> html, body { font-family: "Helvetica Neue","Helvetica","Arial",sans-serif; } *, :before, :after, input { box-sizing: border-box; font-size: 14px; } input { height: 35px; width: 100%; border-radius: 2px; border: 1px solid #cccccc; outline: none; padding: 0 10px; } form { width: 375px; margin: 100px auto; } form .form-row { display: flex; align-items: center; padding: 10px; } form .form-row label { flex-grow: 1; padding-right: 10px; } form .form-row .input { max-width: 150px; width: 150px; } form .form-row .input.focus *, form .form-row .input.focus:before, form .form-row .input.focus:after { border-color: #00A7E1; } form .form-row .input.focus:before, form .form-row .input.focus:after { color: #00A7E1; } [data-prefix], [data-suffix] { position: relative; display: flex; align-items: center; flex-grow: 0; } [data-prefix] input, [data-suffix] input { flex-shrink: 1; flex-grow: 1; } [data-prefix]:before, [data-prefix]:after, [data-suffix]:before, [data-suffix]:after { height: 35px; line-height: 33px; color: #999999; } [data-prefix]:before { content: attr(data-prefix); display: block; padding: 0 0 0 10px; border-top: 1px solid #cccccc; border-left: 1px solid #cccccc; border-bottom: 1px solid #cccccc; border-top-left-radius: 2px; border-bottom-left-radius: 2px; } [data-prefix] input { border-left: none; padding-left: 5px; border-top-left-radius: 0; border-bottom-left-radius: 0; } [data-suffix]:after { content: attr(data-suffix); display: block; padding: 0 10px 0 0; border-top: 1px solid #cccccc; border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc; border-radius: 0 2px 2px 0.........完整代码请登录后点击上方下载按钮下载查看
网友评论0