Skip to content

Instantly share code, notes, and snippets.

@andrewjmead
Last active October 14, 2021 15:31
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save andrewjmead/4783dec59ba2d1e5bcf3e1c301c5858d to your computer and use it in GitHub Desktop.
Save andrewjmead/4783dec59ba2d1e5bcf3e1c301c5858d to your computer and use it in GitHub Desktop.
Chat App CSS
button,button:hover{border:none;color:#fff;padding:10px}.chat__messages,.chat__sidebar ul{list-style-type:none}*{box-sizing:border-box;margin:0;padding:0;font-family:HelveticaNeue-Light,"Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:300;font-size:.95rem}li,ul{list-style-position:inside}h3{font-weight:600;text-align:center;font-size:1.5rem}button{background:#265f82;cursor:pointer;transition:background .3s ease}button:hover{background:#1F4C69}button:disabled{cursor:default;background:#698ea5}.centered-form{display:flex;align-items:center;height:100vh;width:100vw;justify-content:center;background:-moz-linear-gradient(125deg,rgba(39,107,130,1) 0,rgba(49,84,129,1) 100%);background:-webkit-gradient(linear,left top,right bottom,color-stop(0,rgba(49,84,129,1)),color-stop(100%,rgba(39,107,130,1)));background:-webkit-linear-gradient(125deg,rgba(39,107,130,1) 0,rgba(49,84,129,1) 100%);background:-o-linear-gradient(125deg,rgba(39,107,130,1) 0,rgba(49,84,129,1) 100%);background:-ms-linear-gradient(125deg,rgba(39,107,130,1) 0,rgba(49,84,129,1) 100%);background:linear-gradient(325deg,rgba(39,107,130,1) 0,rgba(49,84,129,1) 100%)}.centered-form__form{background:rgba(250,250,250,.9);border:1px solid #e1e1e1;border-radius:5px;padding:0 20px;margin:20px;width:230px}.form-field{margin:20px 0}.form-field>*{width:100%}.form-field label{display:block;margin-bottom:7px}.form-field input,.form-field select{border:1px solid #e1e1e1;padding:10px}.chat{display:flex}.chat__sidebar{overflow-y:scroll;width:260px;height:100vh;background:-moz-linear-gradient(125deg,rgba(39,107,130,1) 0,rgba(49,84,129,1) 100%);background:-webkit-gradient(linear,left top,right bottom,color-stop(0,rgba(49,84,129,1)),color-stop(100%,rgba(39,107,130,1)));background:-webkit-linear-gradient(125deg,rgba(39,107,130,1) 0,rgba(49,84,129,1) 100%);background:-o-linear-gradient(125deg,rgba(39,107,130,1) 0,rgba(49,84,129,1) 100%);background:-ms-linear-gradient(125deg,rgba(39,107,130,1) 0,rgba(49,84,129,1) 100%);background:linear-gradient(325deg,rgba(39,107,130,1) 0,rgba(49,84,129,1) 100%)}.chat__footer,.chat__sidebar li{background:#e6eaee;padding:10px}.chat__sidebar h3{color:#e6eaee;margin:10px 20px;text-align:left}.chat__sidebar li{border:1px solid #e1e1e1;border-radius:5px;margin:10px}.chat__main{display:flex;flex-direction:column;height:100vh;width:100%}.chat__messages{flex-grow:1;overflow-y:scroll;-webkit-overflow-scrolling:touch;padding:10px}.chat__footer{display:flex;flex-shrink:0}.chat__footer form{flex-grow:1;display:flex}.chat__footer form *{margin-right:10px}.chat__footer input{border:none;padding:10px;flex-grow:1}.message{padding:10px}.message__title{display:flex;margin-bottom:5px}.message__title h4{font-weight:600;margin-right:10px}.message__title span{color:#999}@media (max-width:600px){*{font-size:1rem}.chat__sidebar{display:none}.chat__footer{flex-direction:column}.chat__footer form{margin-bottom:10px}.chat__footer button{margin-right:0}}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
font-size: .95rem;
}
ul, li {
list-style-position: inside;
}
h3 {
font-weight: 600;
text-align: center;
font-size: 1.5rem;
}
button {
border: none;
background: #265f82;
color: white;
cursor: pointer;
padding: 10px;
transition: background .3s ease;
}
button:hover {
border: none;
background: #1F4C69;
color: white;
padding: 10px;
}
button:disabled {
cursor: default;
background: #698ea5;
}
.centered-form {
display: flex;
align-items: center;
height: 100vh;
width: 100vw;
justify-content: center;
background: -moz-linear-gradient(125deg, rgba(39,107,130,1) 0%, rgba(49,84,129,1) 100%); /* ff3.6+ */
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, rgba(49,84,129,1)), color-stop(100%, rgba(39,107,130,1))); /* safari4+,chrome */
background: -webkit-linear-gradient(125deg, rgba(39,107,130,1) 0%, rgba(49,84,129,1) 100%); /* safari5.1+,chrome10+ */
background: -o-linear-gradient(125deg, rgba(39,107,130,1) 0%, rgba(49,84,129,1) 100%); /* opera 11.10+ */
background: -ms-linear-gradient(125deg, rgba(39,107,130,1) 0%, rgba(49,84,129,1) 100%); /* ie10+ */
background: linear-gradient(325deg, rgba(39,107,130,1) 0%, rgba(49,84,129,1) 100%); /* w3c */
}
.centered-form__form {
background: rgba(250, 250, 250, 0.9);
border: 1px solid #e1e1e1;
border-radius: 5px;
padding: 0px 20px;
margin: 20px;
width: 230px;
}
.form-field {
margin: 20px 0;
}
.form-field > * {
width: 100%;
}
.form-field label {
display: block;
margin-bottom: 7px;
}
.form-field input, .form-field select {
border: 1px solid #e1e1e1;
padding: 10px;
}
.chat {
display: flex;
}
.chat__sidebar {
overflow-y: scroll;
width: 260px;
height: 100vh;
background: -moz-linear-gradient(125deg, rgba(39,107,130,1) 0%, rgba(49,84,129,1) 100%); /* ff3.6+ */
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, rgba(49,84,129,1)), color-stop(100%, rgba(39,107,130,1))); /* safari4+,chrome */
background: -webkit-linear-gradient(125deg, rgba(39,107,130,1) 0%, rgba(49,84,129,1) 100%); /* safari5.1+,chrome10+ */
background: -o-linear-gradient(125deg, rgba(39,107,130,1) 0%, rgba(49,84,129,1) 100%); /* opera 11.10+ */
background: -ms-linear-gradient(125deg, rgba(39,107,130,1) 0%, rgba(49,84,129,1) 100%); /* ie10+ */
background: linear-gradient(325deg, rgba(39,107,130,1) 0%, rgba(49,84,129,1) 100%); /* w3c */
}
.chat__sidebar h3 {
color: #e6eaee;
margin: 10px 20px;
text-align: left;
}
.chat__sidebar ul {
list-style-type: none;
}
.chat__sidebar li {
background: #e6eaee;
border: 1px solid #e1e1e1;
border-radius: 5px;
padding: 10px;
margin: 10px;
}
.chat__main {
display: flex;
flex-direction: column;
height: 100vh;
width: 100%;
}
.chat__messages {
flex-grow: 1;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
.chat__footer {
background: #e6eaee;
display: flex;
padding: 10px;
/*height: 60px;*/
flex-shrink: 0;
}
.chat__footer form {
flex-grow: 1;
display: flex;
}
.chat__footer form * {
margin-right: 10px;
}
.chat__footer input {
border: none;
padding: 10px;
flex-grow: 1;
}
.chat__messages {
list-style-type: none;
padding: 10px;
}
.message {
padding: 10px;
}
.message__title {
display: flex;
margin-bottom: 5px;
}
.message__title h4 {
font-weight: 600;
margin-right: 10px;
}
.message__title span {
color: #999;
}
@media (max-width: 600px) {
* {
font-size: 1rem;
}
.chat__sidebar {
display: none;
}
.chat__footer {
flex-direction: column;
}
.chat__footer form {
margin-bottom: 10px;
}
.chat__footer button {
margin-right: 0px;
}
}
@Monkeybot9K
Copy link

While working on section 9, Lecture 116 I ran into having the main section of the chat be displayed below the sidebar (this is on MACOS on Chrome Version 67.0.3396.99 (64-bit).

Coming from a native development background (mostly iOS, some C++ and other stuff) I don't know much CSS so I had to ask a friend for help on figuring that one out.
I ended up adding a div that included the main section and sidebar like so:
.main__container { display: flex; flex-direction: row; }

And the issue was fixed.

I also set the sidebar overflow-y to "auto" to prevent the scrollbar from showing if not needed.
These two things differed from the video and stood out right away. I realize the course is not about CSS but you may want to consider Going over this style file a bit for newbies like myself, so we know where/what to look for when things break :)

@DanielFrank
Copy link

While working on section 9, Lecture 116 I ran into having the main section of the chat be displayed below the sidebar (this is on MACOS on Chrome Version 67.0.3396.99 (64-bit).

I think you made the same mistake I did: The main_chat div is supposed to encompass the chat__footer div. It should not be closed before the chat__footer div.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment