Button inside the textarea overlaps text - html

I am having an issue here where the text overlaps the Emoji button .
Basically I want the text to stop before reaching the emoji.
I tried this which surprisingly did not work for me http://jsfiddle.net/36bw0nmo/14/
Thank you
This is my fiddle https://jsfiddle.net/w0s4y5nk/14/
textarea#sendMessage {
height:50px;
width: calc(100vw - 15px);
position: absolute;
bottom: 16px;
resize: none;
border: none;
font-size: 13px;
padding: 5px 5px 5px 10px;
border: solid 5px
}
#myButton {
position: absolute;
bottom: 10px;
right: 5px;
margin-left: 60px;
}
<textarea id="sendMessage"> </textarea>
<p id="myButton" role="img" onclick='$("#picker").toggle()'>&#x1F642</p>
<emoji-picker id="picker"> </emoji-picker>

I hope this is what you want
.textarea-container {
display: flex;
justify-content: space-between;
align-items: flex-end;
height: 50px;
max-width: 96%;
width: 96%;
margin: 0 auto;
position: absolute;
box-sizing: content-box;
bottom: 16px;
padding: 6px;
border: solid 1px #ccc;
border-radius: 4px;
}
textarea#sendMessage {
max-width: 100%;
width: 100%;
height: 100%;
resize: none;
border: none;
font-size: 13px;
scrollbar-width: none;
-ms-overflow-style: none;
}
textarea#sendMessage::-webkit-scrollbar {
display: none;
}
textarea:focus {
outline: none !important;
}
#myButton {
width: 24px;
height: 24px;
display: inline;
cursor: pointer;
padding-left: 4px;
margin: 0;
}
<div class="textarea-container">
<textarea id="sendMessage"> </textarea>
<p id="myButton" role="img" onclick='$("#picker").toggle()'>&#x1F642</p>
<emoji-picker id="picker"> </emoji-picker>
</div>
run snippet code and see the result.

Related

How can I add the search Icon to the search bar in such way that the icon does not overlap the search input?

I have been learning html and css for 2 weeks now, as a challenge I tasked myself to create a product landing page.
I created a search bar and added a "search" icon but I couldn't position the icon in such way that it doesn't overlap the search input.
The image^
The code: I apologise, I know it sucks
#search {
position: relative;
border-radius: 20px;
height: 35px;
width: 250px;
z-index: 1;
margin: -20px 0 0 -150px;
border-style: double;
}
#btn1 {
position: absolute;
z-index: 1;
left: 410px;
top: 35px;
border-radius: 10px;
border: none;
background: url("https://i.ibb.co/D1dvJTV/icons8-search.gif") no-repeat top right;
background-size: 23px auto;
height: 30px;
width: 30px;
}
How can I make the icon stay in the search bar? Because another issue I am having is whenever I resize the page, the icon would move to a new position?
You can add a padding-right to your input to prevent text overlapping the search icon
#search {
border-radius: 20px;
height: 35px;
width: 250px;
z-index: 1;
outline: none;
padding-right: 50px;
}
#search-input-wrapper {
position: relative;
display: inline-block;
}
#search-input-wrapper::after {
content: "";
position: absolute;
z-index: 1;
top: 0;
bottom: 0;
margin: auto;
right: 10px;
background: url("https://i.ibb.co/D1dvJTV/icons8-search.gif") no-repeat center;
background-size: 23px auto;
height: 30px;
width: 30px;
}
<div id="search-input-wrapper">
<input type="text" id="search">
</div>
Try This
.search-bar-container {
border: 2px solid black;
background-color: #ffffff;
width: 400px;
display: flex;
border-radius: 50px;
padding: 10px 20px;
justify-content: center;
align-items: center;
}
input {
width: 95%;
border: none;
outline: none;
font-size: 18px;
padding-right: 10px;
}
.icon {
width: 5%;
text-align: center;
}
<div class="search-bar-container">
<input type="text" placeholder="Search" />
<div class="icon"><i class="fas fa-search"></i></div>
</div>
Codepen: https://codepen.io/manaskhandelwal1/pen/XWjPavP
instead of using input and overlapping icon on it, wrap the input and icon in a tag like div, section, aside whichever one you want.
.search-wrap {
border: 2px solid #000;
border-radius: 8px;
width: fit-content;
padding: 0.3em 1em;
}
#search {
margin: auto;
text-decoration: none;
outline: none;
border: none;
height: 2em;
font-size: 18px;
}
#btn1 {
border-radius: 10px;
background: url("https://i.ibb.co/D1dvJTV/icons8-search.gif");
background-repeat: no-repeat;
background-size: 1.3em;
height: 1.3em;
width: 1.3em;
margin-bottom: -3px;
}
<div class="search-wrap">
<input type="text" id="search" />
<img id="btn1" />
</div>

how do I change the colour of the writing of the active toggle

I have a toggle button that shifts left to right depending what you select, I would like to change the colour of the text inside the button to white if that is the active toggle option you have selected so if you toggle the text inside goes white, however I'm not sure how to achieve this any help would be appreciated thank you
<div class="form-box">
<div class="button-box">
<div id="btn"></div>
<button type="button" class="toggle-btn" onclick="login()">Sign in</button>
<button type="button" class="toggle-btn" onclick="register()">Register</button>
</div>
.form-box {
width: 380px;
height: 660px;
position: relative;
margin: 20% auto;
padding: 5px;
overflow: hidden;
bottom: 150px;
}
.button-box {
width: 220px;
left: 100px;
top: 50px;
position: relative;
display: flex;
box-shadow: 0 0 10px 3px #ff61241f;
border-radius: 30px;
}
.toggle-btn {
padding: 10px 30px;
cursor: pointer;
background: transparent;
border: 0;
outline: none;
position: relative;
}
#btn {
display: flex;
margin-right: auto;
margin-left: auto;
position: absolute;
width: 110px;
height: 100%;
background-color: #fd886b;
border-radius: 30px;
transition: .5s;
}
I have removed the login() and register() functions as they don't serve any purpose to this problem. Also only the text color changes and not the background color as it was not asked but the idea is similar.
function fun(x) {
if(x===1)
{
document.getElementById("b1").style.color="white";
document.getElementById("b2").style.color="black";
}
else
{
document.getElementById("b2").style.color="white";
document.getElementById("b1").style.color="black";
}
}
.form-box {
width: 380px;
height: 660px;
position: relative;
margin: 20% auto;
padding: 5px;
overflow: hidden;
bottom: 150px;
}
.button-box {
width: 220px;
left: 100px;
top: 50px;
position: relative;
display: flex;
box-shadow: 0 0 10px 3px #ff61241f;
border-radius: 30px;
}
.toggle-btn {
padding: 10px 30px;
cursor: pointer;
background: transparent;
border: 0;
outline: none;
position: relative;
}
#btn {
display: flex;
margin-right: auto;
margin-left: auto;
position: absolute;
width: 110px;
height: 100%;
background-color: #fd886b;
border-radius: 30px;
transition: .5s;
}
<div class="form-box">
<div class="button-box">
<div id="btn"></div>
<button id="b1" type="button" class="toggle-btn" onclick="fun(1)" style="color: white">Sign in</button>
<button id="b2" type="button" class="toggle-btn" onclick="fun(2)">Register</button>
</div>
</div>

overlap two div elements

I've got a basic html that contain such lines
<div id="circle">
<div id="slider"></div>
</div>
<div id="audio-player-core" class="controls">
<img src="" alt="nothing" width="65px" height="65px">
</div>
And css
#circle {
width: 100px;
height: 100px;
border: 2px solid rgba(0,0,0,0.5);
border-radius: 100%;
float: left;
margin-left: 10px;
}
#slider {
position: relative;
height: 30px;
width: 30px;
background: rgba(0,0,0,0.5);
border-radius: 100%;
cursor: pointer;
}
.controls {
position: relative;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
z-index: 99;
background-color: transparent;
width: 500px;
margin-left: 20px;
}
#audio-player-core {
border: 1px solid;
border-radius:0 10px 10px 0;
border-color: rgba(0,0,0,0.5);
}
But I cannot make them overlap each other (specifically I want for rectangle to start at the center of the circle while hiding part of circle inside). When I try to move one via margin - another moves and so on.
jsfiddle
How to overlap them?
Use positioning. For example,
#audio-player-core {
border: 1px solid;
border-radius:0 10px 10px 0;
border-color: rgba(0,0,0,0.5);
position: absolute;
left: 50px;
top: 60px;
}
#circle {
width: 100px;
height: 100px;
border: 2px solid rgba(0,0,0,0.5);
border-radius: 100%;
float: left;
margin-left: 10px;
}
#slider {
position: relative;
height: 30px;
width: 30px;
background: rgba(0,0,0,0.5);
border-radius: 100%;
cursor: pointer;
}
.controls {
position: relative;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
z-index: 99;
background-color: transparent;
width: 500px;
margin-left: 20px;
}
#audio-player-core {
border: 1px solid;
border-radius:0 10px 10px 0;
border-color: rgba(0,0,0,0.5);
position: absolute;
left: 50px;
top: 60px;
}
<div id="circle">
<div id="slider"></div>
</div>
<div id="audio-player-core" class="controls">
<img src="" alt="nothing" width="65px" height="65px">
</div>

How to place a triangle on my div to make it look like a speech bubble?

I created a simple div for my comments section.
I would like to give it the appearance of a speech bubble by having a triangle on the left or any other effect that would make it look like a speech bubble coming from the left.
How can I achieve that without using an image ?
image
html
<div class='comment'></div>
css
.comment {
margin-left: 10px;
height: 80px;
display: inline-block;
color: white;
width: 400px;
border: 1px solid white;
padding: 10px;
border-radius: 5px;
overflow: hidden;
}
Try this
.comment {
margin-left: 10px;
height: 80px;
display: inline-block;
color: white;
width: 400px;
border: 1px solid white;
padding: 10px;
border-radius: 5px;
position: relative;
background-color: #fff;
border:1px solid #000;
}
.comment::before{
content:"";
position: absolute;
top:20px;
left:-12px;
margin:auto;
height: 20px;
width: 20px;
border:1px solid #fff;
transform:rotate(45deg);
background-color: #fff;
border-bottom:1px solid #000;
border-left:1px solid #000;
}
<div class='comment'></div>
style accordingly,
hope this helps...
I hope to help you:
.comment {
position: relative;
margin-left: 50px;
margin-top: 50px;
height: 50px;
display: inline-block;
width: 200px;
padding: 10px;
border-radius: 5px;
background: skyblue;
color: #FFF;
}
.comment:before, .comment:after {
content: '';
border-radius: 100%;
position: absolute;
width: 50px;
height: 50px;
z-index: -1;
}
.comment:after {
background-color: #fff;
bottom: -30px;
left: 55px;
}
.comment:before {
background-color: skyblue;
bottom: -20px;
left: 70px;
}
<div class='comment'>Hello,World!</div>
I like Nicholas Gallagher's work best, see his demo page.
This is lifted off his page and is not my own work.
<style>
/* Bubble with an isoceles triangle
------------------------------------------ */
.triangle-isosceles {
position: relative;
padding: 15px;
margin: 1em 0 3em;
color: #000;
background: #f3961c;
border-radius: 10px;
background:linear-gradient(#f9d835, #f3961c);
}
/* creates triangle */
.triangle-isosceles:after {
content: "";
display: block; /* reduce the damage in FF3.0 */
position: absolute;
bottom: -15px;
left: 50px;
width: 0;
border-width: 15px 15px 0;
border-style: solid;
border-color: #f3961c transparent;
}
</style>
<p class="triangle-isosceles">This is a quote. Hello world. text goes here.</p>

How do I get the height to the full page height?

I'm trying to get the iframe the to the full page height, but it's not really working.
I already tried many ways to do it, but none of them would work for me...
I hope some of you know how to do it!
HTML:
<body>
<article>
<h1>Hello world</h1>
<p class="subtitle fancy ">
<span>Versie 1.0</span>
</p>
</article>
<iframe class="configurator " src="" frameBorder="0">Browser not compatible.</iframe>
<footer>
<span class="arrow "></span>
<p>© Copyright 2015</p>
</footer>
</body>
CSS:
html, body {
margin: 0;
padding: 0;
}
body {
background: #ECECEC;
margin: 0px;
color: #333;
font-family:'Cinzel Decorative', cursive;
}
h1 {
font-size: 3em;
text-align: center;
}
article {
max-width: 600px;
overflow: hidden;
margin: 0 auto 50px;
}
.subtitle {
margin: 0 0 2em 0;
}
.fancy {
text-align: center;
display: -webkit-flex;
}
.fancy:before, .fancy:after {
content:"";
border-bottom: 1px solid white;
border-top: 1px solid white;
-webkit-flex: 1;
margin: .45em 0;
}
.fancy:before {
margin-right: 15px;
}
.fancy:after {
margin-left: 15px;
}
footer {
background-color: #D7D7D7;
position: relative;
margin-bottom: 0px;
width: 100%;
height: 50px;
position: absolute;
bottom: 0;
left: 0;
font-family:'Montserrat', sans-serif;
border-top: 2px solid white;
}
footer p {
margin-left: 10px;
font-size: 15px;
color: #626262;
}
footer:before, footer:after, footer > .arrow {
content:"";
position: absolute;
bottom: 100%;
left: 50%;
margin-left: -20px;
border: 20px solid transparent;
border-bottom-color: #D7D7D7;
pointer-events: none;
}
footer:after {
margin-left: -8px;
border-width: 8px;
}
footer > .arrow {
margin-left: -11px;
border-width: 11px;
border-bottom-color: #fff;
}
.configurator {
width: 100%;
background-color: white;
position: absolute;
margin-top: -50px;
margin-bottom: -1000px;
}
So what I want is the iframe height all the way to the bottom against the top of the footer.
jsFiddle: http://jsfiddle.net/94d9tbLx/
Added script to find height .
var h = $(document).outerHeight() - $('article').outerHeight() - $('footer').outerHeight();
$('iframe').css('height', h);
Please check the fiddle - http://jsfiddle.net/afelixj/94d9tbLx/2/
Remove all styles from footer and .configurator and add the following:
footer {
background-color: #D7D7D7;
margin-bottom: 0px;
width: 100%;
height: 50px;
left: 0px;
font-family: "Montserrat",sans-serif;
border-top: 2px solid #FFF;
bottom: 0px;
position: relative;
float: left;
}
.configurator {
width: 100%;
background-color: #FFF;
height: 100vh;
float: left;
position: relative;
}
FIXED JSFIDDLE
(adjust the height to anything)