{"id":8470,"date":"2024-01-14T17:51:00","date_gmt":"2024-01-14T17:51:00","guid":{"rendered":"https:\/\/codehim.com\/?p=8470"},"modified":"2024-01-22T15:53:45","modified_gmt":"2024-01-22T10:53:45","slug":"simple-messaging-ui-html-css-with-example","status":"publish","type":"post","link":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/","title":{"rendered":"Simple Messaging Ui in HTML CSS with Example"},"content":{"rendered":"<p>This code creates a basic messaging UI (user interface) with HTML and CSS. It allows you to select and display chat conversations with different users. The code dynamically sets the active chat when a user is clicked, providing a straightforward way to manage messaging interactions.<\/p>\n<p>It provides a foundation for implementing a basic messaging user interface on your website. You can use this UI design to allow users to facilitate real-time chat, making it suitable for customer support, private messaging, discussion forums, collaborative projects, online communities, and notification systems.<\/p>\n<h2>How to Create Simple Messaging UI In HTML CSS<\/h2>\n<p>1. First of all, load the Google Fonts ad <a href=\"https:\/\/meyerweb.com\/eric\/tools\/css\/reset\/\" target=\"_blank\" rel=\"noopener\">Reset CSS<\/a> by adding the following CDN links into the head tag of your HTML document.<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;link href=\"https:\/\/fonts.googleapis.com\/css?family=Source+Sans+Pro:400,600\" rel=\"stylesheet\"&gt;\r\n&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/meyer-reset\/2.0\/reset.min.css\"&gt;\r\n<\/pre>\n<p>2. Create the HTML structure for the messaging app as follows:<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;div class=\"wrapper\"&gt;\r\n    &lt;div class=\"container\"&gt;\r\n        &lt;div class=\"left\"&gt;\r\n            &lt;div class=\"top\"&gt;\r\n                &lt;input type=\"text\" placeholder=\"Search\" \/&gt;\r\n                &lt;a href=\"javascript:;\" class=\"search\"&gt;&lt;\/a&gt;\r\n            &lt;\/div&gt;\r\n            &lt;ul class=\"people\"&gt;\r\n                &lt;li class=\"person\" data-chat=\"person1\"&gt;\r\n                    &lt;img src=\"https:\/\/s3-us-west-2.amazonaws.com\/s.cdpn.io\/382994\/thomas.jpg\" alt=\"\" \/&gt;\r\n                    &lt;span class=\"name\"&gt;Thomas Bangalter&lt;\/span&gt;\r\n                    &lt;span class=\"time\"&gt;2:09 PM&lt;\/span&gt;\r\n                    &lt;span class=\"preview\"&gt;I was wondering...&lt;\/span&gt;\r\n                &lt;\/li&gt;\r\n                &lt;li class=\"person\" data-chat=\"person2\"&gt;\r\n                    &lt;img src=\"https:\/\/s3-us-west-2.amazonaws.com\/s.cdpn.io\/382994\/dog.png\" alt=\"\" \/&gt;\r\n                    &lt;span class=\"name\"&gt;Dog Woofson&lt;\/span&gt;\r\n                    &lt;span class=\"time\"&gt;1:44 PM&lt;\/span&gt;\r\n                    &lt;span class=\"preview\"&gt;I've forgotten how it felt before&lt;\/span&gt;\r\n                &lt;\/li&gt;\r\n                &lt;li class=\"person\" data-chat=\"person3\"&gt;\r\n                    &lt;img src=\"https:\/\/s3-us-west-2.amazonaws.com\/s.cdpn.io\/382994\/louis-ck.jpeg\" alt=\"\" \/&gt;\r\n                    &lt;span class=\"name\"&gt;Louis CK&lt;\/span&gt;\r\n                    &lt;span class=\"time\"&gt;2:09 PM&lt;\/span&gt;\r\n                    &lt;span class=\"preview\"&gt;But we\u2019re probably gonna need a new carpet.&lt;\/span&gt;\r\n                &lt;\/li&gt;\r\n                &lt;li class=\"person\" data-chat=\"person4\"&gt;\r\n                    &lt;img src=\"https:\/\/s3-us-west-2.amazonaws.com\/s.cdpn.io\/382994\/bo-jackson.jpg\" alt=\"\" \/&gt;\r\n                    &lt;span class=\"name\"&gt;Bo Jackson&lt;\/span&gt;\r\n                    &lt;span class=\"time\"&gt;2:09 PM&lt;\/span&gt;\r\n                    &lt;span class=\"preview\"&gt;It\u2019s not that bad...&lt;\/span&gt;\r\n                &lt;\/li&gt;\r\n                &lt;li class=\"person\" data-chat=\"person5\"&gt;\r\n                    &lt;img src=\"https:\/\/s3-us-west-2.amazonaws.com\/s.cdpn.io\/382994\/michael-jordan.jpg\" alt=\"\" \/&gt;\r\n                    &lt;span class=\"name\"&gt;Michael Jordan&lt;\/span&gt;\r\n                    &lt;span class=\"time\"&gt;2:09 PM&lt;\/span&gt;\r\n                    &lt;span class=\"preview\"&gt;Wasup for the third time like is \r\nyou blind bitch&lt;\/span&gt;\r\n                &lt;\/li&gt;\r\n                &lt;li class=\"person\" data-chat=\"person6\"&gt;\r\n                    &lt;img src=\"https:\/\/s3-us-west-2.amazonaws.com\/s.cdpn.io\/382994\/drake.jpg\" alt=\"\" \/&gt;\r\n                    &lt;span class=\"name\"&gt;Drake&lt;\/span&gt;\r\n                    &lt;span class=\"time\"&gt;2:09 PM&lt;\/span&gt;\r\n                    &lt;span class=\"preview\"&gt;howdoyoudoaspace&lt;\/span&gt;\r\n                &lt;\/li&gt;\r\n            &lt;\/ul&gt;\r\n        &lt;\/div&gt;\r\n        &lt;div class=\"right\"&gt;\r\n            &lt;div class=\"top\"&gt;&lt;span&gt;To: &lt;span class=\"name\"&gt;Dog Woofson&lt;\/span&gt;&lt;\/span&gt;&lt;\/div&gt;\r\n            &lt;div class=\"chat\" data-chat=\"person1\"&gt;\r\n                &lt;div class=\"conversation-start\"&gt;\r\n                    &lt;span&gt;Today, 6:48 AM&lt;\/span&gt;\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    Hello,\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    it's me.\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    I was wondering...\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div class=\"chat\" data-chat=\"person2\"&gt;\r\n                &lt;div class=\"conversation-start\"&gt;\r\n                    &lt;span&gt;Today, 5:38 PM&lt;\/span&gt;\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    Hello, can you hear me?\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    I'm in California dreaming\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble me\"&gt;\r\n                    ... about who we used to be.\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble me\"&gt;\r\n                    Are you serious?\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    When we were younger and free...\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    I've forgotten how it felt before\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div class=\"chat\" data-chat=\"person3\"&gt;\r\n                &lt;div class=\"conversation-start\"&gt;\r\n                    &lt;span&gt;Today, 3:38 AM&lt;\/span&gt;\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    Hey human!\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    Umm... Someone took a shit in the hallway.\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble me\"&gt;\r\n                    ... what.\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble me\"&gt;\r\n                    Are you serious?\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    I mean...\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    It\u2019s not that bad...\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    But we\u2019re probably gonna need a new carpet.\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div class=\"chat\" data-chat=\"person4\"&gt;\r\n                &lt;div class=\"conversation-start\"&gt;\r\n                    &lt;span&gt;Yesterday, 4:20 PM&lt;\/span&gt;\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble me\"&gt;\r\n                    Hey human!\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble me\"&gt;\r\n                    Umm... Someone took a shit in the hallway.\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    ... what.\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    Are you serious?\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble me\"&gt;\r\n                    I mean...\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble me\"&gt;\r\n                    It\u2019s not that bad...\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div class=\"chat\" data-chat=\"person5\"&gt;\r\n                &lt;div class=\"conversation-start\"&gt;\r\n                    &lt;span&gt;Today, 6:28 AM&lt;\/span&gt;\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    Wasup\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    Wasup\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    Wasup for the third time like is &lt;br \/&gt;you blind bitch\r\n                &lt;\/div&gt;\r\n\r\n            &lt;\/div&gt;\r\n            &lt;div class=\"chat\" data-chat=\"person6\"&gt;\r\n                &lt;div class=\"conversation-start\"&gt;\r\n                    &lt;span&gt;Monday, 1:27 PM&lt;\/span&gt;\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    So, how's your new phone?\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    You finally have a smartphone :D\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble me\"&gt;\r\n                    Drake?\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble me\"&gt;\r\n                    Why aren't you answering?\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bubble you\"&gt;\r\n                    howdoyoudoaspace\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div class=\"write\"&gt;\r\n                &lt;a href=\"javascript:;\" class=\"write-link attach\"&gt;&lt;\/a&gt;\r\n                &lt;input type=\"text\" \/&gt;\r\n                &lt;a href=\"javascript:;\" class=\"write-link smiley\"&gt;&lt;\/a&gt;\r\n                &lt;a href=\"javascript:;\" class=\"write-link send\"&gt;&lt;\/a&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<p>3. Use the following CSS to style the chat interface. You can modify the CSS rules to match your website\/app template.<\/p>\n<pre class=\"prettyprint linenums lang-css\">@charset \"UTF-8\";\r\n*, *:before, *:after {\r\n  box-sizing: border-box !important;\r\n}\r\n\r\n:root {\r\n  --white: #fff;\r\n  --black: #000;\r\n  --bg: #f8f8f8;\r\n  --grey: #999;\r\n  --dark: #1a1a1a;\r\n  --light: #e6e6e6;\r\n  --wrapper: 1000px;\r\n  --blue: #00b0ff;\r\n}\r\n\r\nbody {\r\n  background-color: var(--bg);\r\n  -webkit-font-smoothing: antialiased;\r\n  -moz-osx-font-smoothing: grayscale;\r\n  text-rendering: optimizeLegibility;\r\n  font-family: \"Source Sans Pro\", sans-serif;\r\n  font-weight: 400;\r\n  background-image: url(\"https:\/\/s3-us-west-2.amazonaws.com\/s.cdpn.io\/382994\/image.jpg\");\r\n  background-size: cover;\r\n  background-repeat: none;\r\n}\r\n\r\n.wrapper {\r\n  position: relative;\r\n  left: 50%;\r\n  width: var(--wrapper);\r\n  height: 800px;\r\n  transform: translate(-50%, 0);\r\n}\r\n\r\n.container {\r\n  position: relative;\r\n  top: 50%;\r\n  left: 50%;\r\n  width: 80%;\r\n  height: 75%;\r\n  background-color: var(--white);\r\n  transform: translate(-50%, -50%);\r\n}\r\n.container .left {\r\n  float: left;\r\n  width: 37.6%;\r\n  height: 100%;\r\n  border: 1px solid var(--light);\r\n  background-color: var(--white);\r\n}\r\n.container .left .top {\r\n  position: relative;\r\n  width: 100%;\r\n  height: 96px;\r\n  padding: 29px;\r\n}\r\n.container .left .top:after {\r\n  position: absolute;\r\n  bottom: 0;\r\n  left: 50%;\r\n  display: block;\r\n  width: 80%;\r\n  height: 1px;\r\n  content: \"\";\r\n  background-color: var(--light);\r\n  transform: translate(-50%, 0);\r\n}\r\n.container .left input {\r\n  float: left;\r\n  width: 188px;\r\n  height: 42px;\r\n  padding: 0 15px;\r\n  border: 1px solid var(--light);\r\n  background-color: #eceff1;\r\n  border-radius: 21px;\r\n  font-family: \"Source Sans Pro\", sans-serif;\r\n  font-weight: 400;\r\n}\r\n.container .left input:focus {\r\n  outline: none;\r\n}\r\n.container .left a.search {\r\n  display: block;\r\n  float: left;\r\n  width: 42px;\r\n  height: 42px;\r\n  margin-left: 10px;\r\n  border: 1px solid var(--light);\r\n  background-color: var(--blue);\r\n  background-image: url(\"https:\/\/s3-us-west-2.amazonaws.com\/s.cdpn.io\/382994\/name-type.png\");\r\n  background-repeat: no-repeat;\r\n  background-position: top 12px left 14px;\r\n  border-radius: 50%;\r\n}\r\n.container .left .people {\r\n  margin-left: -1px;\r\n  border-right: 1px solid var(--light);\r\n  border-left: 1px solid var(--light);\r\n  width: calc(100% + 2px);\r\n}\r\n.container .left .people .person {\r\n  position: relative;\r\n  width: 100%;\r\n  padding: 12px 10% 16px;\r\n  cursor: pointer;\r\n  background-color: var(--white);\r\n}\r\n.container .left .people .person:after {\r\n  position: absolute;\r\n  bottom: 0;\r\n  left: 50%;\r\n  display: block;\r\n  width: 80%;\r\n  height: 1px;\r\n  content: \"\";\r\n  background-color: var(--light);\r\n  transform: translate(-50%, 0);\r\n}\r\n.container .left .people .person img {\r\n  float: left;\r\n  width: 40px;\r\n  height: 40px;\r\n  margin-right: 12px;\r\n  border-radius: 50%;\r\n  -o-object-fit: cover;\r\n     object-fit: cover;\r\n}\r\n.container .left .people .person .name {\r\n  font-size: 14px;\r\n  line-height: 22px;\r\n  color: var(--dark);\r\n  font-family: \"Source Sans Pro\", sans-serif;\r\n  font-weight: 600;\r\n}\r\n.container .left .people .person .time {\r\n  font-size: 14px;\r\n  position: absolute;\r\n  top: 16px;\r\n  right: 10%;\r\n  padding: 0 0 5px 5px;\r\n  color: var(--grey);\r\n  background-color: var(--white);\r\n}\r\n.container .left .people .person .preview {\r\n  font-size: 14px;\r\n  display: inline-block;\r\n  overflow: hidden !important;\r\n  width: 70%;\r\n  white-space: nowrap;\r\n  text-overflow: ellipsis;\r\n  color: var(--grey);\r\n}\r\n.container .left .people .person.active, .container .left .people .person:hover {\r\n  margin-top: -1px;\r\n  margin-left: -1px;\r\n  padding-top: 13px;\r\n  border: 0;\r\n  background-color: var(--blue);\r\n  width: calc(100% + 2px);\r\n  padding-left: calc(10% + 1px);\r\n}\r\n.container .left .people .person.active span, .container .left .people .person:hover span {\r\n  color: var(--white);\r\n  background: transparent;\r\n}\r\n.container .left .people .person.active:after, .container .left .people .person:hover:after {\r\n  display: none;\r\n}\r\n.container .right {\r\n  position: relative;\r\n  float: left;\r\n  width: 61.4%;\r\n  height: 100%;\r\n}\r\n.container .right .top {\r\n  width: 100%;\r\n  height: 47px;\r\n  padding: 15px 29px;\r\n  background-color: #eceff1;\r\n}\r\n.container .right .top span {\r\n  font-size: 15px;\r\n  color: var(--grey);\r\n}\r\n.container .right .top span .name {\r\n  color: var(--dark);\r\n  font-family: \"Source Sans Pro\", sans-serif;\r\n  font-weight: 600;\r\n}\r\n.container .right .chat {\r\n  position: relative;\r\n  display: none;\r\n  overflow: hidden;\r\n  padding: 0 35px 92px;\r\n  border-width: 1px 1px 1px 0;\r\n  border-style: solid;\r\n  border-color: var(--light);\r\n  height: calc(100% - 48px);\r\n  justify-content: flex-end;\r\n  flex-direction: column;\r\n}\r\n.container .right .chat.active-chat {\r\n  display: block;\r\n  display: flex;\r\n}\r\n.container .right .chat.active-chat .bubble {\r\n  transition-timing-function: cubic-bezier(0.4, -0.04, 1, 1);\r\n}\r\n.container .right .chat.active-chat .bubble:nth-of-type(1) {\r\n  -webkit-animation-duration: 0.15s;\r\n          animation-duration: 0.15s;\r\n}\r\n.container .right .chat.active-chat .bubble:nth-of-type(2) {\r\n  -webkit-animation-duration: 0.3s;\r\n          animation-duration: 0.3s;\r\n}\r\n.container .right .chat.active-chat .bubble:nth-of-type(3) {\r\n  -webkit-animation-duration: 0.45s;\r\n          animation-duration: 0.45s;\r\n}\r\n.container .right .chat.active-chat .bubble:nth-of-type(4) {\r\n  -webkit-animation-duration: 0.6s;\r\n          animation-duration: 0.6s;\r\n}\r\n.container .right .chat.active-chat .bubble:nth-of-type(5) {\r\n  -webkit-animation-duration: 0.75s;\r\n          animation-duration: 0.75s;\r\n}\r\n.container .right .chat.active-chat .bubble:nth-of-type(6) {\r\n  -webkit-animation-duration: 0.9s;\r\n          animation-duration: 0.9s;\r\n}\r\n.container .right .chat.active-chat .bubble:nth-of-type(7) {\r\n  -webkit-animation-duration: 1.05s;\r\n          animation-duration: 1.05s;\r\n}\r\n.container .right .chat.active-chat .bubble:nth-of-type(8) {\r\n  -webkit-animation-duration: 1.2s;\r\n          animation-duration: 1.2s;\r\n}\r\n.container .right .chat.active-chat .bubble:nth-of-type(9) {\r\n  -webkit-animation-duration: 1.35s;\r\n          animation-duration: 1.35s;\r\n}\r\n.container .right .chat.active-chat .bubble:nth-of-type(10) {\r\n  -webkit-animation-duration: 1.5s;\r\n          animation-duration: 1.5s;\r\n}\r\n.container .right .write {\r\n  position: absolute;\r\n  bottom: 29px;\r\n  left: 30px;\r\n  height: 42px;\r\n  padding-left: 8px;\r\n  border: 1px solid var(--light);\r\n  background-color: #eceff1;\r\n  width: calc(100% - 58px);\r\n  border-radius: 5px;\r\n}\r\n.container .right .write input {\r\n  font-size: 16px;\r\n  float: left;\r\n  width: 347px;\r\n  height: 40px;\r\n  padding: 0 10px;\r\n  color: var(--dark);\r\n  border: 0;\r\n  outline: none;\r\n  background-color: #eceff1;\r\n  font-family: \"Source Sans Pro\", sans-serif;\r\n  font-weight: 400;\r\n}\r\n.container .right .write .write-link.attach:before {\r\n  display: inline-block;\r\n  float: left;\r\n  width: 20px;\r\n  height: 42px;\r\n  content: \"\";\r\n  background-image: url(\"https:\/\/s3-us-west-2.amazonaws.com\/s.cdpn.io\/382994\/attachment.png\");\r\n  background-repeat: no-repeat;\r\n  background-position: center;\r\n}\r\n.container .right .write .write-link.smiley:before {\r\n  display: inline-block;\r\n  float: left;\r\n  width: 20px;\r\n  height: 42px;\r\n  content: \"\";\r\n  background-image: url(\"https:\/\/s3-us-west-2.amazonaws.com\/s.cdpn.io\/382994\/smiley.png\");\r\n  background-repeat: no-repeat;\r\n  background-position: center;\r\n}\r\n.container .right .write .write-link.send:before {\r\n  display: inline-block;\r\n  float: left;\r\n  width: 20px;\r\n  height: 42px;\r\n  margin-left: 11px;\r\n  content: \"\";\r\n  background-image: url(\"https:\/\/s3-us-west-2.amazonaws.com\/s.cdpn.io\/382994\/send.png\");\r\n  background-repeat: no-repeat;\r\n  background-position: center;\r\n}\r\n.container .right .bubble {\r\n  font-size: 16px;\r\n  position: relative;\r\n  display: inline-block;\r\n  clear: both;\r\n  margin-bottom: 8px;\r\n  padding: 13px 14px;\r\n  vertical-align: top;\r\n  border-radius: 5px;\r\n}\r\n.container .right .bubble:before {\r\n  position: absolute;\r\n  top: 19px;\r\n  display: block;\r\n  width: 8px;\r\n  height: 6px;\r\n  content: \" \";\r\n  transform: rotate(29deg) skew(-35deg);\r\n}\r\n.container .right .bubble.you {\r\n  float: left;\r\n  color: var(--white);\r\n  background-color: var(--blue);\r\n  align-self: flex-start;\r\n  -webkit-animation-name: slideFromLeft;\r\n          animation-name: slideFromLeft;\r\n}\r\n.container .right .bubble.you:before {\r\n  left: -3px;\r\n  background-color: var(--blue);\r\n}\r\n.container .right .bubble.me {\r\n  float: right;\r\n  color: var(--dark);\r\n  background-color: #eceff1;\r\n  align-self: flex-end;\r\n  -webkit-animation-name: slideFromRight;\r\n          animation-name: slideFromRight;\r\n}\r\n.container .right .bubble.me:before {\r\n  right: -3px;\r\n  background-color: #eceff1;\r\n}\r\n.container .right .conversation-start {\r\n  position: relative;\r\n  width: 100%;\r\n  margin-bottom: 27px;\r\n  text-align: center;\r\n}\r\n.container .right .conversation-start span {\r\n  font-size: 14px;\r\n  display: inline-block;\r\n  color: var(--grey);\r\n}\r\n.container .right .conversation-start span:before, .container .right .conversation-start span:after {\r\n  position: absolute;\r\n  top: 10px;\r\n  display: inline-block;\r\n  width: 30%;\r\n  height: 1px;\r\n  content: \"\";\r\n  background-color: var(--light);\r\n}\r\n.container .right .conversation-start span:before {\r\n  left: 0;\r\n}\r\n.container .right .conversation-start span:after {\r\n  right: 0;\r\n}\r\n\r\n@keyframes slideFromLeft {\r\n  0% {\r\n    margin-left: -200px;\r\n    opacity: 0;\r\n  }\r\n  100% {\r\n    margin-left: 0;\r\n    opacity: 1;\r\n  }\r\n}\r\n@-webkit-keyframes slideFromLeft {\r\n  0% {\r\n    margin-left: -200px;\r\n    opacity: 0;\r\n  }\r\n  100% {\r\n    margin-left: 0;\r\n    opacity: 1;\r\n  }\r\n}\r\n@keyframes slideFromRight {\r\n  0% {\r\n    margin-right: -200px;\r\n    opacity: 0;\r\n  }\r\n  100% {\r\n    margin-right: 0;\r\n    opacity: 1;\r\n  }\r\n}\r\n@-webkit-keyframes slideFromRight {\r\n  0% {\r\n    margin-right: -200px;\r\n    opacity: 0;\r\n  }\r\n  100% {\r\n    margin-right: 0;\r\n    opacity: 1;\r\n  }\r\n}<\/pre>\n<p>4. Finally, add the following JavaScript function between &lt;script&gt; tag just before closing the body element to activate the basic interaction of the chat.<\/p>\n<pre class=\"prettyprint linenums lang-js\">document.querySelector('.chat[data-chat=person2]').classList.add('active-chat');\r\ndocument.querySelector('.person[data-chat=person2]').classList.add('active');\r\n\r\nlet friends = {\r\n  list: document.querySelector('ul.people'),\r\n  all: document.querySelectorAll('.left .person'),\r\n  name: '' },\r\n\r\nchat = {\r\n  container: document.querySelector('.container .right'),\r\n  current: null,\r\n  person: null,\r\n  name: document.querySelector('.container .right .top .name') };\r\n\r\n\r\nfriends.all.forEach(f =&gt; {\r\n  f.addEventListener('mousedown', () =&gt; {\r\n    f.classList.contains('active') || setAciveChat(f);\r\n  });\r\n});\r\n\r\nfunction setAciveChat(f) {\r\n  friends.list.querySelector('.active').classList.remove('active');\r\n  f.classList.add('active');\r\n  chat.current = chat.container.querySelector('.active-chat');\r\n  chat.person = f.getAttribute('data-chat');\r\n  chat.current.classList.remove('active-chat');\r\n  chat.container.querySelector('[data-chat=\"' + chat.person + '\"]').classList.add('active-chat');\r\n  friends.name = f.querySelector('.name').innerText;\r\n  chat.name.innerHTML = friends.name;\r\n}<\/pre>\n<p>That&#8217;s all! hopefully, you have successfully integrated this Simple HTML &amp; CSS Messaging UI into your web\/app project. If you have any questions or suggestions, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This code creates a basic messaging UI (user interface) with HTML and CSS. It allows you to select and display&#8230;<\/p>\n","protected":false},"author":1,"featured_media":8478,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[63],"tags":[],"class_list":["post-8470","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html5-css3"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Simple Messaging Ui in HTML CSS with Example &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a free code snippet to create a Simple Messaging Ui in HTML CSS with Example. You can view demo and download the source code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Simple Messaging Ui in HTML CSS with Example &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a free code snippet to create a Simple Messaging Ui in HTML CSS with Example. You can view demo and download the source code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-14T17:51:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T10:53:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/09\/Simple-Messaging-Ui-HTML-CSS-With-Example.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"960\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"Simple Messaging Ui in HTML CSS with Example\",\"datePublished\":\"2024-01-14T17:51:00+00:00\",\"dateModified\":\"2024-01-22T10:53:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/\"},\"wordCount\":218,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/09\/Simple-Messaging-Ui-HTML-CSS-With-Example.png\",\"articleSection\":[\"HTML5 &amp; CSS3\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/\",\"url\":\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/\",\"name\":\"Simple Messaging Ui in HTML CSS with Example &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/09\/Simple-Messaging-Ui-HTML-CSS-With-Example.png\",\"datePublished\":\"2024-01-14T17:51:00+00:00\",\"dateModified\":\"2024-01-22T10:53:45+00:00\",\"description\":\"Here is a free code snippet to create a Simple Messaging Ui in HTML CSS with Example. You can view demo and download the source code.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/09\/Simple-Messaging-Ui-HTML-CSS-With-Example.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/09\/Simple-Messaging-Ui-HTML-CSS-With-Example.png\",\"width\":1280,\"height\":960,\"caption\":\"Simple Messaging Ui HTML CSS With Example\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML5 &amp; CSS3\",\"item\":\"https:\/\/codehim.com\/category\/html5-css3\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Simple Messaging Ui in HTML CSS with Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Simple Messaging Ui in HTML CSS with Example &#8212; CodeHim","description":"Here is a free code snippet to create a Simple Messaging Ui in HTML CSS with Example. You can view demo and download the source code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/","og_locale":"en_US","og_type":"article","og_title":"Simple Messaging Ui in HTML CSS with Example &#8212; CodeHim","og_description":"Here is a free code snippet to create a Simple Messaging Ui in HTML CSS with Example. You can view demo and download the source code.","og_url":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-01-14T17:51:00+00:00","article_modified_time":"2024-01-22T10:53:45+00:00","og_image":[{"width":1280,"height":960,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/09\/Simple-Messaging-Ui-HTML-CSS-With-Example.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"Simple Messaging Ui in HTML CSS with Example","datePublished":"2024-01-14T17:51:00+00:00","dateModified":"2024-01-22T10:53:45+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/"},"wordCount":218,"commentCount":0,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/09\/Simple-Messaging-Ui-HTML-CSS-With-Example.png","articleSection":["HTML5 &amp; CSS3"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/","url":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/","name":"Simple Messaging Ui in HTML CSS with Example &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/09\/Simple-Messaging-Ui-HTML-CSS-With-Example.png","datePublished":"2024-01-14T17:51:00+00:00","dateModified":"2024-01-22T10:53:45+00:00","description":"Here is a free code snippet to create a Simple Messaging Ui in HTML CSS with Example. You can view demo and download the source code.","breadcrumb":{"@id":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/09\/Simple-Messaging-Ui-HTML-CSS-With-Example.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/09\/Simple-Messaging-Ui-HTML-CSS-With-Example.png","width":1280,"height":960,"caption":"Simple Messaging Ui HTML CSS With Example"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/html5-css3\/simple-messaging-ui-html-css-with-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"HTML5 &amp; CSS3","item":"https:\/\/codehim.com\/category\/html5-css3\/"},{"@type":"ListItem","position":3,"name":"Simple Messaging Ui in HTML CSS with Example"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":4596,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/8470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=8470"}],"version-history":[{"count":0,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/8470\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/8478"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=8470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=8470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=8470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}