How to outline only the border-radius when input is selected? - html

.sear {
height: 50px;
width: 400px;
border: 0.5px solid black;
border-radius: 15px 0px 0px 15px;
}
.sear:focus {
//how to make only the border radius and other part of box selected?
}
.bar {
display: inline;
height: 50px;
width: 60px;
border: 0.5px solid black;
background-color: #ECECEC;
border-radius: 0px 15px 15px 0px;
}
.bar:hover {
cursor: pointer;
}
<input type="text" style="display: inline; margin-left: 20%;" class="sear" placeholder="Search...">
<button class="bar">🔎</button>
I was just wondering if it is possible to select only the border-radius and the rest of the box when the mouse is focused on the input as opposed to the corner of the box.

If you want to remove the default outline (which is not recommended for accessibility reasons) and add your own you can do this by changing the border color on focus but I would recommend wrapping the elements with a div and using javascript to add and remove a class to make this styling change like this:
var btnGroup = document.querySelector('.btn-group');
var input = document.querySelector('.sear');
input.onfocus = function() {
btnGroup.classList.add('focus');
}
input.onblur = function() {
btnGroup.classList.remove('focus');
}
.btn-group {
display: flex;
align-items: center;
position: relative;
width: 100%;
border: 1px solid black;
border-radius: 15px;
background-color: white;
width: 400px;
}
.btn-group.focus {
border-color: rebeccapurple;
}
.sear {
flex: 1;
border: none;
padding: .5rem;
margin: 0 0 0 0.5rem;
line-height: 1rem;
font-size: 1rem;
outline: none;
}
.bar {
padding: .5rem 1.5rem;
width: 60px;
background-color: #ECECEC;
border-radius: 0px 15px 15px 0px;
outline: none;
border-left: 1px solid #999;
}
.bar:hover {
cursor: pointer;
}
<div class="btn-group">
<input type="text" class="sear" placeholder="Search...">
<button class="bar">🔎</button>
</div>

for example:
.sear:focus {
/* to change the border when selected. */
border: 2px solid #0000ff;
}

If you are looking to have outline radius, its not posisble as mentioned in the comments, as a work around you can have something like this:
.sear {
height: 50px;
width: 400px;
border: 0.5px solid black;
border-radius: 15px 0px 0px 15px;
}
.sear:focus {
outline: none;
border-color: #9ecaed;
box-shadow: 0 0 2px #9ecaed;
}
.bar {
display: inline;
height: 50px;
width: 60px;
border: 0.5px solid black;
background-color: #ECECEC;
border-radius: 0px 15px 15px 0px;
}
.bar:hover {
cursor: pointer;
}
<input type="text" style="display: inline; margin-left: 20%;" class="sear" placeholder="Search...">
<button class="bar">🔎</button>

Just trying to understand what you want.
May be something like this ?
.sear {
height: 50px;
width: 400px;
border: 1px solid black;
border-radius: 15px 0px 0px 15px;
margin-left: 20px;
}
.sear:focus {
border-top: solid 3px blue;
border-left: solid 3px blue;
border-bottom: solid 3px blue;
margin-top: -2px;
}
.sear:focus + .bar {
border-top: solid 3px blue;
border-right: solid 3px blue;
border-bottom: solid 3px blue;
}
.bar {
display: inline-block;
height: 54px;
width: 60px;
border: 1px solid black;
background-color: #ECECEC;
border-radius: 0px 15px 15px 0px;
}
.bar:hover {
cursor: pointer;
}
<input type="text" class="sear" placeholder="Search..."/>
<button class="bar">🔎</button>

Related

Pseudo-element layers under element above it

I'm trying to show a notification overlay on a div. My attempt thus far has failed to get the overlay on top of everything, while keeping it relative to it's related button.
Perhaps using ::after isn't the right approach? Any suggestions would be appreciated.
.user-container {
display: flex;
flex-flow: column;
width: 300px;
float: left;
}
.user-welcome-message-container {
border-bottom: solid 2px #ffe398;
display: flex;
float: right;
text-align: right;
padding-top: 15px;
justify-content: flex-end;
}
.user-action-btns-container {
display: flex;
justify-content: flex-end;
}
#user-btn-1:hover {
cursor: pointer;
background-color: #c6e5ff;
border-top: solid 0px;
border-left: solid 1px #5babff;
border-bottom: solid 1px #5babff;
border-right: solid 1px #5babff;
box-sizing: border-box;
transition: 0.2s;
}
#user-btn-1 {
font-family: sans-serif;
font-style: normal;
position: relative;
width: 110px;
font-size: 0.8em;
color: black;
background-color: #fff3d3;
padding: 7px;
margin-right: 15px;
text-align: center;
box-sizing: border-box;
border-top: solid 0px;
border-left: solid 1px #e8cb2a;
border-bottom: solid 1px #e8cb2a;
border-right: solid 1px #e8cb2a;
border-radius: 0px 0px 5px 5px;
box-shadow: 0px 0px 5px rgb(0 0 0 / 20%);
clip-path: inset(0px -5px -5px -5px);
transition: 0.2s;
}
#favorites-btn-text::after {
content: "7";
position: absolute;
top: -5px;
left: 100px;
border-radius: 10px;
padding: 4px;
background-color: #a4dbff;
}
<div class="user-container">
<div class="user-welcome-message-container">
</div>
<div class="user-action-btns-container">
<div id="user-btn-1" title="Favorites">
<i aria-hidden="true" class="fa-solid fa-bookmark" title="Your favorites"> <span id="favorites-btn-text">Favorites</span></i>
</div>
</div>
</div>
Replace left: 100px; with right: 0;, apply a transform moving the element right by half its width (to accomodate for two-digit numbers as well) using transform, and make sure there's enough gap between your buttons. Consider using the column-gap CSS property to control the gap.
Also move the content to a data-attribute: data-notification-count.
.user-container {
display: flex;
flex-flow: column;
width: 300px;
float: left;
}
.user-welcome-message-container {
border-bottom: solid 2px #ffe398;
display: flex;
float: right;
text-align: right;
padding-top: 15px;
justify-content: flex-end;
}
.user-action-btns-container {
display: flex;
justify-content: flex-end;
}
#user-btn-1:hover {
cursor: pointer;
background-color: #c6e5ff;
border-top: solid 0px;
border-left: solid 1px #5babff;
border-bottom: solid 1px #5babff;
border-right: solid 1px #5babff;
box-sizing: border-box;
transition: 0.2s;
}
#user-btn-1 {
font-family: sans-serif;
font-style: normal;
position: relative;
width: 110px;
font-size: 0.8em;
color: black;
background-color: #fff3d3;
padding: 7px;
margin-right: 15px;
text-align: center;
box-sizing: border-box;
border-top: solid 0px;
border-left: solid 1px #e8cb2a;
border-bottom: solid 1px #e8cb2a;
border-right: solid 1px #e8cb2a;
border-radius: 0px 0px 5px 5px;
box-shadow: 0px 0px 5px rgb(0 0 0 / 20%);
clip-path: inset(0px -5px -5px -5px);
transition: 0.2s;
}
#user-btn-1::after {
content: attr(data-notification-count);
position: absolute;
top: 0;
right: 0;
border-radius: 10px;
padding: 4px;
background-color: #a4dbff;
transform: translate(50%, -5px);
}
<div class="user-container">
<div class="user-welcome-message-container">
</div>
<div class="user-action-btns-container">
<div id="user-btn-1" title="Favorites" data-notification-count="14">
<i aria-hidden="true" class="fa-solid fa-bookmark" title="Your favorites"> <span id="favorites-btn-text">Favorites</span></i>
</div>
</div>
</div>

How to make a full window page height border for divider?

I'm attempting to make a login page for a website, https://essaydapp.com to submit and try and get into the application. I'm trying to mimic their design (see link) but I'm having some issues:
Screenshots:
https://imgur.com/w2GAphF
https://imgur.com/rimWY0s
In the first screenshot you can see the little 1px dashed border, I would like that to be the height of the entire page rather than the form only.
In the second screenshot you can see on the edges of the page and top there is the white color, but I would like that to be blue too. Thanks for any help in advance.
form {
/*border: 10px solid #1acebc;*/
padding: 28px;
border-left: 1px solid black;
border-left-style: dashed;
border-right: 1px solid black;
border-right-style: dashed;
}
button:hover {
opacity: 0.8;
}
button {
background-color: #09c;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
input[type=text],
input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #1acebc;
box-sizing: border-box;
}
img {
display: block;
margin: 0 auto;
padding-bottom: 60px;
padding-top: 30px;
width: 300px;
height: 300px;
}
body {
background-color: #e7f3f6;
/*border-left: 250px solid #007da5;
border-right: 250px solid #007da5;*/
border-left: 175px solid #007da5;
border-right: 175px solid #007da5;
padding-top: 175px;
padding-bottom: 215px;
}
<form>
<img src="https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png" alt="profilepicture">
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<button type="button" name="Login">Login</button>
</form>
This code removes any padding from left and right.
I hope that's what you want.
body{
border: 1px dashed;
backgroud-color: #e7f3f6;
margin-left: 0px;
margin-right: 0px;
}
Your existing code is somewhat messy. Instead, I suggest to use the following flex-box solution
body {
padding: 0;
margin: 0 auto;
background-color: #007da5;
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
form {
display: flex;
width: 75%; /*Set the width required*/
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #e7f3f6;
border-left: 1px dashed black;
border-right: 1px dashed black;
}
img {
width: 300px;
height: 300px;
padding-bottom: 60px;
padding-top: 30px;
}
button:hover {
opacity: 0.8;
}
button {
background-color: #09c;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 85%;
}
input[type=text],
input[type=password] {
width: 85%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #1acebc;
box-sizing: border-box;
}
<form>
<img src="https://i.imgur.com/ihZBCxx.png" alt="profilepicture">
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<button type="button" name="Login">Login</button>
</form>

How to Combine CSS in one class make usable for Blogger template

I'm trying to create a text box mixture of HTML/CSS. I have CSS code for designing of text box. I want to use this code in blogger but I'm unable to combine the CSS in one class so that use in blogger. Someone help me please. Thanks.
CSS and HTML:
body {
background-color: #f1f1f1;
font-family: Helvetica,Arial,Verdana;
}
.link-box,.link-wrapper {
position: relative;
padding: 10px;
}
.link-wrapper {
width: 500px;
margin: auto;
margin-top: 50px;
}
.link-box {
width: 80%;
border: 1px solid #ccc;
outline: 0;
border-radius: 15px;
}
.link-box:focus {
box-shadow: 0 0 15px 5px #b0e0ee;
border: 1px solid #0AA700;
}
<div class="link-wrapper">
<input type="text" onClick="this.select();" name="focus" required class="link-box" value="www.google.com" readonly/>
</div>
Not entirely what you mean by one class. But if you mean you can only have a class on the parent div and not on the input, this would work.
.link-wrapper {
position: relative;
width: 500px;
margin: auto;
margin-top: 50px;
padding: 10px;
}
.link-wrapper input {
width: 80%;
border: 1px solid #ccc;
outline: 0;
border-radius: 15px;
padding: 10px;
}
.link-wrapper input:focus {
box-shadow: 0 0 15px 5px #b0e0ee;
border: 1px solid #0AA700;
}

Text Editor in Angular js

Have used the below code for text editor with bullet listing in it.
<div text-angular="text-angular" ng-model="comments"
style="border: 1px solid #e1e1e1;"
ta-toolbar="[['ul']]" name="htmlcontent1" class="form-control myform1-height"
ta-html-editor-class="form-control myform1-height">
</div>
the issue is the text editor doesn't popup keyboard when touched.
have used below css for it.
.closing-textarea {
width: 100%;
margin-top: 30px;
border: 1px solid #dee5e7;
outline: none;
-webkit-appearance: none;
resize: none;
padding: 10px;
}
.closing-comments-wrapper .form-control {
border: none;
border-top: 1px solid #e1e1e1;
/*padding: 10px;*/
/*border: 2px dashed #DDD;*/
}
.closing-comments-wrapper .ta-editor.form-control.myform1-height, .ta-scroll-window.form-control.myform1-height {
min-height: 150px;
height: auto;
overflow: auto;
font-family: inherit;
font-size: 100%;
}
.closing-comments-wrapper .form-control.myform1-height > .ta-bind {
height: auto;
min-height: 150px;
padding: 6px 12px;
}
.closing-comments-wrapper .btn-group>.btn:first-child {
background: rgb(255, 255, 255);
float: right;
}
.closing-comments-wrapper .btn-group {
float: right;
}
.ta-hidden-input {
display: none;
}

CSS: Adding border to button on hover. How avoiding a shifting of the following elements? [duplicate]

This question already has answers here:
I want to add a border to my button on hover event without moving the button or anything [duplicate]
(7 answers)
Closed 6 years ago.
My idea is to add a colored border to the submit button when the user hovers it.
body div:first-child {
padding: 10px 20px;
background-color: #dedede;
margin-top: 50px;
margin-left: 300px;
width: 120px;
height: 80px;
border-radius: 8px;
}
button {
border-radius: 4px;
padding: 5px 10px;
}
button:hover {
border: 6px solid crimson;
font-weight: 800;
background-color: white;
color: crimson;
}
<div class="container">
<button>SUBMIT</button>
<div>Please notice that ...</div>
</div>
But the immediately following text then becomes shifted downwards.
How can I get rid of these "Jumping" text while simultaneously having the border?
You need to define transparent border by default on button and change border-color on hover. Further avoid changing font-weight property on hover as well as it will also expand the width and height of button and it will jump on hover.
body div:first-child {
padding: 10px 20px;
background-color: #dedede;
margin-top: 50px;
margin-left: 300px;
width: 120px;
height: 80px;
border-radius: 8px;
}
button {
border: 6px solid transparent;
font-weight: 800;
border-radius: 4px;
padding: 5px 10px;
}
button:hover {
border-color: crimson;
background-color: white;
color: crimson;
}
<div class="container">
<button>SUBMIT</button>
<div>Please notice that ...</div>
</div>
Add "margin" attributes to your "button" CSS like so:
button {
border-radius: 4px;
padding: 5px 10px;
margin: 4px 0;
}
button:hover {
border: 6px solid crimson;
font-weight: 800;
background-color: white;
color: crimson;
margin: 0;
}
From Stop an element moving with padding on hover.
Just to give an alternative you could use outline to set the "border" on hover.
body div:first-child {
padding: 10px 20px;
background-color: #dedede;
margin-top: 50px;
margin-left: 300px;
width: 120px;
height: 80px;
border-radius: 8px;
}
button {
border: 0;
border-radius: 4px;
padding: 5px 10px;
margin: 5px 0;
}
button:hover {
outline: 6px solid crimson;
font-weight: 800;
background-color: white;
color: crimson;
}
<div class="container">
<button>SUBMIT</button>
<div>Please notice that ...</div>
</div>
Another option:
body div:first-child {
padding: 10px 20px;
background-color: #dedede;
margin-top: 50px;
margin-left: 300px;
width: 120px;
height: 80px;
border-radius: 8px;
}
button {
border-radius: 4px;
padding: 5px 10px;
margin: 6px 0;
border-width: 2px;
border-style: outset;
border-color: buttonface;
}
button:hover {
border-width: 6px;
border-style: solid;
border-color: crimson;
font-weight: 800;
margin: 2px 0;
background-color: white;
color: crimson;
}
<div class="container">
<button>SUBMIT</button>
<div>Please notice that ...</div>
</div>
Here are some possibilities:
Style the button dimensions (padding/margin/border) with the same px/em values like it's :hover state
set the button position to absolute/fixed
Use a fix height in a parent div
check now
body div:first-child {
padding: 10px 20px;
background-color: #dedede;
margin-top: 50px;
margin-left: 300px;
width: 120px;
height: 80px;
border-radius: 8px;
}
button {
border-radius: 4px;
padding: 5px 10px;
border: 6px solid transparent;
}
button:hover {
border: 6px solid crimson;
font-weight: 800;
background-color: white;
color: crimson;
}
<div class="container">
<button>SUBMIT</button>
<div>Please notice that ...</div>
</div>
Try adding height to button
body div:first-child {
padding: 10px 20px;
background-color: #dedede;
margin-top: 50px;
margin-left: 300px;
width: 120px;
height: 80px;
border-radius: 8px;
}
button {
border-radius: 4px;
padding: 5px 10px;
height:40px
}
button:hover {
border: 6px solid crimson;
font-weight: 800;
background-color: white;
color: crimson;
}
<div class="container">
<button>SUBMIT</button>
<div>Please notice that ...</div>
</div>
Add padding of the same size as the border to the button, and remove it on hover.
Mention the width and height to the button and remove the font-weight to avoiding a shifting of the element when hover the elements. Check below code.
body div:first-child {
padding: 10px 20px;
background-color: #dedede;
margin-top: 50px;
margin-left: 300px;
width: 120px;
height: 80px;
border-radius: 8px;
}
button {
border-radius: 4px;
padding: 5px 10px;
height:50px;
width:100px;
}
button:hover {
/*font-weight: 800;
background-color: white;*/
border: 6px solid crimson;
color: crimson;
}
<div class="container">
<button>SUBMIT</button>
<div>Please notice that ...</div>
</div>
body div:first-child {
padding: 10px 20px;
background-color: #dedede;
margin-top: 50px;
margin-left: 300px;
width: 120px;
height: 80px;
border-radius: 8px;
}
button {
border-radius: 4px;
padding: 5px 10px;
height:50px;
width:100px;
}
button:hover {
border: 6px solid crimson;
background-color: white;
color: crimson;
}
<div class="container">
<button>SUBMIT</button>
<div>Please notice that ...</div>
</div>