Contact form 7表单css样式代码

Contact Form 7是Wordpress插件,不需要多做介绍,作为询盘表单插件,全球使用人数最多。虽然功能强大,但是外观太丑,需要手写CSS。

虽然CSS我也不是很会,通过谷歌查找教程,也学了些基本,把表单基本上改改还是能看,最起码比没改好吧。

没加CSS之前:

加了CSS之后:

虽然改的不是很好,起码还是能稍微看一下。

表单代码:

  1. [text* your-name placeholder akismet:author "Your Name"]
  2.  
  3. [email* your-email placeholder akismet:author_email "Your-Email"]
  4.  
  5. [textarea* your-message x5 placeholder "Enter your inquiry details such as product name, color, size, MOQ, FOB, etc."]
  6.  
  7. <p style="text-align: center;">*We respect your confidentiality and all information are protected.</p>
  8. [submit "Send"]

CSS如下:

  1. .wpcf7-text,.wpcf7-textarea{
  2. width:100%;
  3. font-size: 16px !important;
  4. padding:12px !important;
  5. }
  6. .wpcf7-submit{
  7. width:100%;
  8. background-color: #0060bf!important;
  9. color: white;
  10. border:none !important;
  11. font-size: 16px !important;
  12. padding:10px !important;
  13. }

响应式拆分2列表单:

表单代码:

  1. <div id="responsive-form" class="clearfix">
  2.  
  3. <div class="form-row">
  4. <div class="column-half">[text* your-name placeholder "Your Name"]</div>
  5. <div class="column-half">[email* your-email placeholder "your-email"]</div>
  6. </div>
  7.  
  8. <div class="form-row">
  9. <div class="column-full">[textarea your-message placeholder "Enter your inquiry details such as product name, color, size, MOQ, FOB, etc."]</div>
  10. </div>
  11.  
  12. <div class="form-row">
  13. <div class="column-full">[submit "Send"]</div>
  14. </div>
  15.  
  16. </div><!--end responsive-form-->

CSS优化代码:

  1. /*Contact form 7两列*/
  2. #responsive-form{
  3. max-width:600px /*-- change this to get your desired form width --*/;
  4. margin:0 auto;
  5. width:100%;
  6. }
  7. .form-row{
  8. width: 100%;
  9. }
  10. .column-half, .column-full{
  11. float: left;
  12. position: relative;
  13. padding: 0.65rem;
  14. width:100%;
  15. -webkit-box-sizing: border-box;
  16. -moz-box-sizing: border-box;
  17. box-sizing: border-box
  18. }
  19. .clearfix:after {
  20. content: "";
  21. display: table;
  22. clear: both;
  23. }
  24. /**---------------- Media query ----------------**/
  25. @media only screen and (min-width: 48em) {
  26. .column-half{
  27. width: 50%;
  28. }
  29. }
  30. .wpcf7 input[type="text"], .wpcf7 input[type="email"], .wpcf7 textarea {
  31. width: 100%;
  32. padding: 8px;
  33. border: 1px solid #ccc;
  34. border-radius: 3px;
  35. -webkit-box-sizing: border-box;
  36. -moz-box-sizing: border-box;
  37. box-sizing: border-box
  38. }
  39. .wpcf7 input[type="text"]:focus{
  40. background: #fff;
  41. }
  42. .wpcf7-submit{
  43. float: right;
  44. background: #CA0002;
  45. color: #fff;
  46. text-transform: uppercase;
  47. border: none;
  48. padding: 8px 20px;
  49. cursor: pointer;
  50. }
  51. .wpcf7-submit:hover{
  52. background: #ff0000;
  53. }
  54. span.wpcf7-not-valid-tip{
  55. text-shadow: none;
  56. font-size: 12px;
  57. color: #fff;
  58. background: #ff0000;
  59. padding: 5px;
  60. }
  61. div.wpcf7-validation-errors {
  62. text-shadow: none;
  63. border: transparent;
  64. background: #f9cd00;
  65. padding: 5px;
  66. color: #9C6533;
  67. text-align: center;
  68. margin: 0;
  69. font-size: 12px;
  70. }
  71. div.wpcf7-mail-sent-ok{
  72. text-align: center;
  73. text-shadow: none;
  74. padding: 5px;
  75. font-size: 12px;
  76. background: #59a80f;
  77. border-color: #59a80f;
  78. color: #fff;
  79. margin: 0;
  80. }
WordPress技巧

使用WP-CLI命令管理 WordPress

2020-5-25 5:02:29

WordPress技巧

Wordpress侧边添加Whatsapp,skype,QQ社交等浮动菜单

2020-12-10 1:09:49

4 条回复 A文章作者 M管理员
欢迎您,新朋友,感谢参与互动!
  1. 能否把前面两栏并排显示呢?

    • 个人不太喜欢。但也可以分两列,看文章代码

    • 小朱笔记

      我粘贴了这段代码,但是没用

    • 哪就不是代码的问题了

个人中心
购物车
优惠劵
今日签到
私信列表
搜索
51La