So I'm trying to align badge , username and message for streamlabs chat.
currently have made this : https://i.imgur.com/fydIZgn.png ,
but want it to look like this : https://i.imgur.com/QFw8YeA.png
so here is html and css not sure what im missing here but hope someone can help me with this
also if somebody does not have badges want his name to start from left without gaps which currently works with this setup.
<!-- chat item -->
<script type="text/template" id="chatlist_item">
<div data-from="{from}" data-id="{messageId}">
<span class="meta" style="color: {color}">
<span class="badges"></span>
<span class="name">{from}</span>
<span class="message">{message}</span>
</span>
</div>
</script>
#import url(https://fonts.googleapis.com/css?family=Roboto:700);
* {
box-sizing: border-box;
}
html, body {
height: 100%;
overflow: hidden;
}
body {
text-shadow: 0 0 1px #000, 0 0 2px #000;
background: {background_color};
font-family: 'Roboto';
font-weight: 700;
font-size: {font_size};
line-height: 1.5em;
color: {text_color};
}
#log>div {
animation: fadeInRight .3s ease forwards, fadeOut 0.5s ease {message_hide_delay} forwards;
-webkit-animation: fadeInRight .3s ease forwards, fadeOut 0.5s ease {message_hide_delay} forwards;
}
.colon {
display: none;
}
#log {
display: table;
position: absolute;
bottom: 0;
left: 0;
padding: 0 10px 10px;
width: 100%;
table-layout: fixed;
}
#log>div {
display: table-row;
}
#log>div.deleted {
visibility: hidden;
}
#log .emote {
background-repeat: no-repeat;
background-position: center;
background-size: contain;
padding: 0.4em 0.2em;
position: relative;
}
#log .emote img {
display: inline-block;
height: 1em;
opacity: 0;
}
#log .message,#log .meta {
vertical-align: top;
display: table-cell;
padding-bottom: 0.1em;
margin-left: 0.2em;
}
#log .meta {
width: 35%;
text-align: left;
padding-right: 0.5em;
white-space: nowrap;
text-overflow: clip;
overflow: hidden;
}
#log .message {
word-wrap: break-word;
white-space: initial;
width: 65%;
display: inline-block;
color: #fff;
}
.badge {
display: inline-block;
margin-right: 0.2em;
position: relative;
height: 1em;
vertical-align: middle;
top: -0.1em;
}
.name {
margin-left: 0.2em;
}
Removing display : inline-block should do the trick . Inline-block create block elements without line breakers . In this case badges , name and messages are separate block elements positioned next to each other . Each element will still have its own boundaries and properties like margin can be applied to each of them .
Since your requirement is to display them as inline , either change inline-block to 'inline' or remove the inline-block as span in already an inline element
Related
I have a problem with text clipping, practically when I set the div to a lower width than the text, it disappears. I want it to clip words as it reduces its size... I tried with overflow: hidden and also text-overflow: clip but it's not working as I want. Here's the code, thank you in advance.
.finalCutStyleButton{
width: 90mm;
height: 20mm;
background-color: #b3be9e;
animation: test 2s ease-in;
}
#keyframes test{
from{
width: 90mm;
}
to{
width: 30mm;
}
}
.title{
font-size: 10mm;
font-family: 'SFProBold', sans-serif;
font-weight: bold;
display: inline-block;
width: auto;
}
<div class = "finalCutStyleButton adjustPadding">
<h1 class = "title">VIDEO EDITING</h1>
</div>
try adding same keyframe logic to the text:
.finalCutStyleButton {
width: 90mm;
height: 20mm;
background-color: #b3be9e;
display: flex;
align-items: center;
animation: test 2s ease-in;
}
#keyframes test {
from {
width: 90mm;
}
to {
width: 30mm;
}
}
.title {
font-size: 10mm;
margin: 0 0;
font-family: "SFProBold", sans-serif;
font-weight: bold;
display: inline-block;
min-width: 100%;
white-space: nowrap;
overflow: hidden;
}
<div class="finalCutStyleButton adjustPadding">
<h1 class="title">VIDEO EDITING</h1>
</div>
This is a CSS and HTML animation, simple text filling.
For some reason the text jumps when there is a space or if I add a dash?
Below you can see the output:
I've added the code below!
.comingsoon-loading {
font-family: 'Poppins', sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.comingsoon-loading h1 {
position: absolute;
font-size: 20vh;
color: #ffcc00;
-webkit-text-stroke: 2px black;
text-transform: uppercase;
}
.comingsoon-loading h1::before {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
color: black;
-webkit-text-stroke: 0px black;
border-right: 4px solid black;
overflow: hidden;
animation: animate 6s linear infinite;
}
/* animation to fill text */
#keyframes animate
{
0%,10%,100%
{
width: 0;
}
50%,70%
{
width: 100%;
}
}
<div class="comingsoon-loading">
<h1 data-text="COMING-SOON">COMING-SOON</h1>
</div>
The problem lies in the way you handle text in your animation.
You are animating a string of text appearing slowly but don't account for any of the inherit string properties such as line breaking.
During your animation, the first word: "COMING", appears normally as the width increases, but once the hyphen appears, HTML thinks you have inserted a word break point and tries to break "SOON" to a new line.
This can be solved by adding white-space: nowrap; to your ::before section, to prevent it from breaking as the animation plays out.
HTML
<div class="comingsoon-loading">
<h1 data-text="COMING-SOON">COMING-SOON</h1>
</div>
CSS
.comingsoon-loading {
font-family: 'Poppins', sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: blue;
}
.comingsoon-loading h1 {
position: absolute;
font-size: 20vh;
color: #ffcc00;
-webkit-text-stroke: 2px black;
text-transform: uppercase;
}
.comingsoon-loading h1::before {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
color: black;
-webkit-text-stroke: 0px black;
border-right: 2px solid black;
overflow: hidden;
animation: animate 5s linear infinite;
white-space: nowrap;
}
/* animation to fill text */
#keyframes animate {
0%,
10%,
100% {
width: 0;
}
50%,
70% {
width: 100%;
}
}
My html code is
<tr>
<td><input type="image" style="height:25px; width:25px;" src="plus.png"></td>
</tr>
The cell is being created but image is not showing. However, if I use img tag, it is showing, so no problem with image's src.
EDIT: The CSS linked maybe the problem, but cannot figure out what:-
*{
font-family: Arial, sans;
margin: 0;
padding: 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
h1 {
margin: 1em 0;
text-align: center;
}
#container {
margin: 0 auto;
width: 50%;
}
#container input {
height: 2.5em;
visibility: hidden;
}
#container label {
background: #f9f9f9;
border-radius: 1em 1em 0 0;
color: #888;
cursor: pointer;
display: block;
float: left;
font-size: 1em;
height: 2.5em;
line-height: 2.5em;
margin-right: .25em;
padding: 0 1.5em;
text-align: center;
}
#container input:hover + label {
background: #ddd;
color: #666;
}
#container input:checked + label {
background: #DBF3FD;
color: #444;
position: relative;
z-index: 6;
/*
-webkit-transition: .1s;
-moz-transition: .1s;
-o-transition: .1s;
-ms-transition: .1s;
*/
}
#content {
background: #DBF3FD;
border-radius: 0 .25em .25em .25em;
min-height: 18em;
position: relative;
width: 100%;
z-index: 5;
}
#content div {
opacity: 0;
padding: 1.5em;
position: absolute;
z-index: -100;
}
#content-1 p {
clear: both;
margin-bottom: 1em;
}
#content-1 p.last {
margin-bottom: 0;
}
#content-2 p {
float: left;
width: 48.5%;
}
#content-2 p.column-right {
margin-left: 3%;
}
#content-3 p {
float: left;
width: 48.5%;
}
#content-3 p.column-right {
margin-left: 3%;
}
#container input#tab-1:checked ~ #content #content-1,
#container input#tab-2:checked ~ #content #content-2,
#container input#tab-3:checked ~ #content #content-3
{
opacity: 1;
z-index: 100;
}
input.visible {
visibility: visible !important;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(odd) {
background-color: #FFFFFF;
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding: 8px;
text-align: left;
border-bottom: 1px solid #ddd;
}
tr:hover{background-color:#96DCF7}
In your code, you write that input:
input.visible {
visibility: visible !important;
}
But you also have:
input {
visibility: hidden;
}
You never refer to the .visible class on the code you show us, so it stays hidden. Maybe this is the problem. Try adding class="visible" to the input.
<tr>
<td>
<input class="visible" type="image" style="height:25px; width:25px;" src="plus.png">
</td>
</tr>
Try with css. Add style=" background-image: url("plus.png");" to input tag. input type="image" is not valid property of type attribute.
This seems to be a problem with the other code interacting with your html. The following code works for me:
<table>
<thead>
<tr>
<th>Image</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="image" src="Image.png"></td>
</tr>
</tbody>
</table>
Maybe you should start here and then add your styles back little by little until you find whatever caused the problem.
EDIT: I copied all the code you have put here and assumed that you had a div with an id of container and another div with an id of content and that your table lived in there. Following #Benjamin Naesen's advice I set the visibility to visible and the picture appeared.
input.visible {
visibility: visible;
}
Did this work for you?
I have been trying to create animation of text appearing/disappearing.
But this is well known problem of animating display property.
I have tried to use opacity and position instead but still no luck.
I don't want to animate this in only one way, I'm just trying to hide one text and show another with arrow animation. But if it is possible to implement this transition in another way, for instance flip, fade or whatever.
Here is my code
HTML
<div class="wrapper">
<nav class="series-navigation">
<div class="series-navigation__container">
<div class="series-navigation__direction series-navigation__direction--previous">
<div class="series-navigation-item series-navigation-item--previous">
<a href="#" class="series-navigation-item__link">
<span class="sop-arrow-left series-navigation-item__icon series-navigation-item__icon--previous"></span>
<span class="series-navigation-item__title series-navigation-item__title--part">Part 1 </span>
<span class="series-navigation-item__title series-navigation-item__title--name">Article name of Part 1</span>
</a>
</div>
</div>
<div class="series-navigation__divider"></div>
<div class="series-navigation__direction series-navigation__direction--next">
<div class="series-navigation-item series-navigation-item--next">
<a href="#" class="series-navigation-item__link">
<span class="series-navigation-item__title series-navigation-item__title--part">Part 3</span>
<span class="series-navigation-item__title series-navigation-item__title--name">Article name of Part 3</span>
<span class="sop-arrow-right series-navigation-item__icon series-navigation-item__icon--next"></span>
</a>
</div>
</div>
</div>
</nav>
</div>
CSS
.sop-arrow-right:before {
content: ">";
}
.sop-arrow-left:before {
content: "<";
}
.wrapper {
margin-top: 1.25em;
overflow: hidden;
font-size: 1.25em;
padding: 1em;
background-color: #fff;
border-radius: 5px;
}
.series-navigation-item__link:hover .series-navigation-item__title--part,
.series-navigation-item__title--name {
visibility: hidden;
opacity: 0;
position: absolute;
}
.series-navigation-item__link:hover .series-navigation-item__title--name,
.series-navigation-item__title--part {
visibility: visible;
opacity: 1;
position: relative;
}
.series-navigation {
text-align: center;
display: block;
width: 100%;
}
.series-navigation__container {
position: relative;
width: 100%;
}
.series-navigation__divider {
position: absolute;
vertical-align: middle;
display: inline-block;
height: 100%;
width: 1px;
background: #52b3d9;
}
.series-navigation__direction {
position: relative;
padding-top: 1.25em;
padding-bottom: 1.25em;
vertical-align: middle;
display: inline-block;
width: 48%;
}
.series-navigation__direction--next {
padding-right: 0.25em;
}
.series-navigation__direction--previous {
padding-left: 0.25em;
}
.series-navigation-item {
display: block;
width: 100%;
}
.series-navigation-item__link {
width: 100%;
}
.series-navigation-item__link:hover .series-navigation-item__icon--next {
margin-right: -0.625em;
margin-left: 0.625em;
}
.series-navigation-item__link:hover .series-navigation-item__icon--previous {
margin-left: -0.625em;
margin-right: 0.625em;
}
.series-navigation-item__title {
font-size: 1em !important;
display: inline-block;
vertical-align: middle;
width: 90%;
}
#media only screen and (max-width: 768px) {
.series-navigation-item__title {
width: 80%;
font-size: 0.875em !important;
}
}
.series-navigation-item__title--part {
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.series-navigation-item__title--name {
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.series-navigation-item__icon {
width: 10%;
vertical-align: middle;
display: inline-block;
font-size: 1.4375em !important;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.series-navigation-item--previous {
padding-left: 0;
text-align: left;
}
.series-navigation-item--previous .series-navigation-item__title {
padding-right: 0.625em;
}
.series-navigation-item--next {
padding-right: 0;
text-align: right;
}
.series-navigation-item--next .series-navigation-item__title {
padding-left: 0.625em;
}
And live example as well https://jsfiddle.net/CROSP/ebztkwx1/14/
As you can see the animation looks ugly (probably because of position property), furthermore this doesn't work in Safari browser (no animation).
I would be grateful for any help or advice how to achieve desired result.
Thanks.
P.S. no JS & poorly supported browser features.
I've been working on an element where the "borders" or under/overlines would meet on the left and right side of the element in a slow transition.
This is where I've got so far: http://codepen.io/anon/pen/RRNjgo
.sliding-middle-out:hover {
font-size: 30px;
transition: font-size 2s ease;
}
.dark {
background-color: black;
display: inline-block;
min-width: 200px;
min-height: 300px;text-align: center;
cursor: pointer;
}
.dark h1 {
color: white;
text-align: center;
}
.sliding-middle-out {
display: inline-block;
position: relative;
padding-bottom: 3px;
}
.sliding-middle-out h1:after {
content: '';
display: block;
margin: auto;
height: 3px;
width: 0px;
background: transparent;
transition: width 2s ease, background-color .5s ease;
}
.sliding-middle-out:hover h1:after {
width: 50%;
background: #b7d333;
}
.sliding-middle-out h1:before {
content: '';
display: block;
margin: auto;
height: 3px;
width: 0px;
background: transparent;
transition: width 2s ease, background-color .5s ease;
}
.sliding-middle-out:hover h1:before {
width: 50%;
background: #b7d333;
border-left: 1px solid black;
}
<div class="dark sliding-middle-out">
<h1 class="">FAQs</h1>
</div>
One approach I tried was to display borders on the h1 element after the under/overline transition was finished, but couldn't get it to work.
But I cant figure out how i would get the desired effect.
got the base for this project from here.
http://bradsknutson.com/blog/css-sliding-underline/
Take another element like span inside h1 and make border right and left effect on them.
for example
Html
<div class="dark sliding-middle-out">
<h1 class=""><span>FAQs</span></h1>
</div>
css
.sliding-middle-out h1 span {
position: relative;
}
.sliding-middle-out h1 span:after,
.sliding-middle-out h1 span:before {
content: '';
display: block;
margin: auto;
width: 3px;
transition: height 2s ease, background-color .5s ease;
background: #B7D333;
top: 0;
bottom: 0;
height: 0;
position: absolute;
}
.sliding-middle-out h1 span:before {
left: -5px;
}
.sliding-middle-out h1 span:after {
right: -5px;
}
.sliding-middle-out:hover h1 span:after,
.sliding-middle-out:hover h1 span:before {
height:50%;
}
Demo