I am using a CSS button code, but I found some problem in doing it. I want that the width of my button should get fixed for the mobile view but it should be auto for the window. how can I do it, please help? Or it should be auto placed in the center. I am using this code. I am using CSS like this.
CSS code :
.button1
{
border: 2px solid rgb(0, 0, 0);
box-sizing: inherit;
background-color: #ffffff;
margin-right: 1.7px;
color: black;
font-size: 18px;
font-weight: 980;
padding: 6px 42px;
text-align: center;
transition: all 0.3s ease-in-out 0s;
width: 96.6px;
text-decoration: none;
line-height: 22px;
font-size: 16px;
font-family: domine;
display: inline-table;
}
.button2
{
border: 2px solid rgb(255, 87, 51);
background-color: #FF5733;
box-sizing: inherit;
margin-right: 1.7px;
color: white;
font-size: 18px;
font-weight: 980;
padding: 6px 42px;
text-align: center;
transition: all 0.3s ease-in-out 0s;
width: 96.6px;
text-decoration: none;
line-height: 22px;
font-size: 16px;
font-family: domine;
display: inline-table;
}
.button2 a:link, .button2 a:visited
{
background-color: #FF5733;
color: white;
text-decoration: none;
}
.button2 a:hover, .button2 a:active
{
background-color: #FF5733;
color:#000000;
}
#media screen and (max-width: 680px) and (min-width:0px)
{
.button2 { padding: 6px 32px;width: 85px;display: inline-table;max-height:80px;}
.button1 { padding: 6px 32px;width: 85px;max-height:88px;}
}
HTML code:
<button class="button button1">
BUY NOW
</button>
<button class="button button2">
DETALS
</button>
For a start, change the button display from inline-table to inline-block
I have these hover effects set up and it doesn't seem to be changing a thing. I can't figure out why.
Same thing happens with the primary button at the bottom.
body { background-color: #aaa }
.button {
background: #fff;
border-radius: 5px;
border: none;
padding: 5px;
width: 100px;
height: 50px;
}
.button:hover {
background: #1c1c1c;
color: #fff;
transition: 0.3s ease;
cursor: pointer;
}
.button-primary {
background: yellow;
border-radius: 5px;
border: none;
padding: 5px;
width: 100px;
height: 50px;
margin-bottom: 10px;
}
.button-primary:hover {
background: #1c1c1c;
transition: 0.3s ease;
}
.button-down {
height: 70px;
width: 70px;
border-radius: 50%;
border: 1px solid white;
background: transparent;
color: white;
}
.button-down:hover {
background: white;
color: #1c1c1c;
border: 1px solid #1c1c1c;
cursor: pointer;
}
<div>
<div class="down">
<button class='button-down'><i class='fas fa-arrow-down'></i></button>
</div>
<input type="text" name='email' id='email' placeholder='signup to our newsletter...'>
<br>
<button class='button-primary' type='submit' name='submit'>Submit</button>
</div>
You linked your stylesheet to your html?
Also, .button-down class in is not declared in css but instead you have .button
Replace .button with .button-down and try again.
.button-down{
background: #fff;
border-radius: 5px;
border: none;
padding: 5px;
width: 100px;
height: 50px;
}
.button-down:hover{
background: #1c1c1c;
color: #fff;
transition: 0.3s ease;
cursor: pointer;
}
I currently have a slider with a hover, but is there a way to make the hover a circle that will appear as a circle in all browsers? Is there also a way to change the shape of the slider from a rectangle to a line? I have also tried to remove the random line that appears above the slider but can't seem to remove it, is there something obvious that I am missing?
Thank you!
#container {
padding: 300px 500px;
}
#frequencySlider {
margin-top: 1px;
width: 100%;
}
#frequencyLabel {
margin-top: 1px;
}
#toggleAudio {
padding: 10px 20px;
height: center;
width: center;
font-size: 15px;
background: #939393;
color: white;
opacity: 0.7;
}
/* Slider */
.slider {
-webkit-appearance: none;
appearance: none;
width: 100%;
height: 8px;
background: #908e8e;
opacity: 0.2;
-webkit-transition: .3s;
transition: opacity .3s;
}
.slider:hover {}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 12px;
height: 20px;
background: #0b38b4;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 12px;
height: 20px;
background: #0b38b4;
cursor: pointer;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="container">
<button id="toggleAudio">
Click Here
</button>
<hr>
<input type="range" min="100" max="4000" value="2000" step="1" class="slider" id="frequencySlider">
<br>
<p id="frequencyLabel">Frequency: 2000 Hz</p>
</div>
</body>
</html>
Also works in IE11 -> full example
#frequencySlider {
margin-top: 1px;
width: 100%;
}
#frequencyLabel {
margin-top: 1px;
}
#toggleAudio {
padding: 10px 20px;
height: center;
width: center;
font-size: 15px;
background: #939393;
color: white;
opacity: 0.7;
}
/* Slider */
input[type=range] {
width: 100%;
height: 25px;
margin: 10px 0;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: transparent;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 5px;
cursor: pointer;
background: #f00;
border-radius: 1px;
border: 0px solid #000;
color: transparent;
}
input[type=range]::-ms-track {
width: 100%;
height: 5px;
cursor: pointer;
background: #f00;
border-radius: 1px;
border: 0px solid #000;
color: transparent;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 5px;
cursor: pointer;
background: #f00;
border-radius: 1px;
border: 0px solid #000;
color: transparent;
}
input[type=range]::-moz-range-thumb {
border: 1px solid #000;
height: 18px;
width: 18px;
border-radius: 50%;
background: rgb(33, 150, 243);
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin-top: -7px;
}
input[type=range]::-ms-thumb {
border: 1px solid #000;
height: 18px;
width: 18px;
border-radius: 50%;
background: rgb(33, 150, 243);
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin-top: -7px;
}
input[type=range]::-webkit-slider-thumb {
border: 1px solid #000;
height: 18px;
width: 18px;
border-radius: 50%;
background: rgb(33, 150, 243);
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin-top: -7px;
}
/* fix for IE11 */
input[type=range]::-ms-thumb {
height: 15px;
width: 15px;
margin-top: 0;
background: rgb(33, 150, 243);
}
<div id="container">
<button id="toggleAudio">
Click Here
</button>
<label id="range" class="range">
<input type="range" min="100" max="4000" value="2000" step="1" id="frequencySlider">
</label>
<br>
<p id="frequencyLabel">Frequency: 2000 Hz</p>
</div>
How do I properly align two buttons side by side with some space between them using css and html only?
Here is my html and css. The two buttons are not aligned properly.
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
}
body {
background-color: #0c0129;
background-image: url(coding.jpg);
background-position: center;
background-size: cover;
background-blend-mode: soft-light;
}
.heading {
width: 600px;
height: 300px;
margin: auto;
position: absolute;
top: 0px;
bottom: 0px;
right: 0px;
left: 0px;
outline: none;
}
.title1 {
display: block;
text-align: center;
color: white;
font-size: 50pt;
font-family: fantasy;
}
.title2 {
display: block;
margin-top: 16px;
text-align: center;
color: white;
font-size: 15pt;
font-family: sans-serif;
}
.register {
margin: 50px auto;
display: block;
width: 180px;
height: 50px;
border: 3px solid white;
background-color: rgba(255, 255, 255, 0);
color: white;
font-family: sans-serif;
font-weight: bold;
border-radius: 5px;
float: left;
transition: background-color 1000ms, color 1000ms;
}
.register:hover {
background-color: rgba(255, 255, 255, 1);
color: #222;
cursor: pointer;
transition: background-color 1000ms, color 1000ms;
}
.login {
margin: 20px auto;
display: block;
width: 180px;
height: 50px;
border: 3px solid white;
background-color: rgba(255, 255, 255, 0);
color: white;
font-family: sans-serif;
font-weight: bold;
border-radius: 5px;
float: right;
transition: background-color 1000ms, color 1000ms;
}
.login:hover {
background-color: rgba(255, 255, 255, 1);
color: #222;
cursor: pointer;
transition: background-color 1000ms, color 1000ms;
}
ul {
list-style: none;
}
<div class="heading">
<span class="title1">Banerjee Solutions</span>
<span class="title2">Your one stop shop for everything tech.</span>
<ul>
<li><button class="register">REGISTER NOW</button></li>
<li><button class="login">LOG IN</button></li>
</ul>
</div>
What do I need to modify to get the my desired result?
Here is my solution using flex
ul {
list-style: none;
display: flex;
align-items: center;
justify-content: center;
}
li {
margin: auto;
}
In your css classes you have more margin in your register class (using by the first button) than in your login class (using by your second button). They must have the same margin so they appears in line.
For instance put the login class the same as the register class, just like this:
.login {
margin: 50px auto;
display: block;
width: 180px;
height: 50px;
border: 3px solid white;
background-color: rgba(255, 255, 255, 0);
color: white;
font-family: sans-serif;
font-weight: bold;
border-radius: 5px;
float: right;
transition: background-color 1000ms, color 1000ms;
}
The li's of your list are block level elements - so to get the buttons to be on the same row - simply have the li's display: inline. Also the margins for each button were different - so making those the same allows them to be in line with each other. Each button is floated - one to the left and one to the right so each is positioned to the side of the container.
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
}
body {
background-color: #0c0129;
background-image: url(coding.jpg);
background-position: center;
background-size: cover;
background-blend-mode: soft-light;
}
.heading {
width: 600px;
height: 300px;
margin: auto;
position: absolute;
top: 0px;
bottom: 0px;
right: 0px;
left: 0px;
outline: none;
}
.title1 {
display: block;
text-align: center;
color: white;
font-size: 50pt;
font-family: fantasy;
}
.title2 {
display: block;
margin-top: 16px;
text-align: center;
color: white;
font-size: 15pt;
font-family: sans-serif;
}
.register {
margin: 20px auto;
display: block;
width: 180px;
height: 50px;
border: 3px solid white;
background-color: rgba(255, 255, 255, 0);
color: white;
font-family: sans-serif;
font-weight: bold;
border-radius: 5px;
float: left;
transition: background-color 1000ms, color 1000ms;
}
.register:hover {
background-color: rgba(255, 255, 255, 1);
color: #222;
cursor: pointer;
transition: background-color 1000ms, color 1000ms;
}
.login {
margin: 20px auto;
display: block;
width: 180px;
height: 50px;
border: 3px solid white;
background-color: rgba(255, 255, 255, 0);
color: white;
font-family: sans-serif;
font-weight: bold;
border-radius: 5px;
float: right;
transition: background-color 1000ms, color 1000ms;
}
.login:hover {
background-color: rgba(255, 255, 255, 1);
color: #222;
cursor: pointer;
transition: background-color 1000ms, color 1000ms;
}
ul {
list-style: none;
}
ul li {display: inline}
<div class="heading">
<span class="title1">Banerjee Solutions</span>
<span class="title2">Your one stop shop for everything tech.</span>
<ul>
<li><button class="register">REGISTER NOW</button></li>
<li><button class="login">LOG IN</button></li>
</ul>
</div>
Check the following code
Changed Element structure.
removed float property , and added display: inline-block in login and register class
added btn-container class
.btn-container{
margin-top: 30px;
text-align: center;
}
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
}
body {
background-color: #0c0129;
background-image: url(coding.jpg);
background-position: center;
background-size: cover;
background-blend-mode: soft-light;
}
.heading {
width: 600px;
height: 300px;
margin: auto;
position: absolute;
top: 0px;
bottom: 0px;
right: 0px;
left: 0px;
outline: none;
}
.title1 {
display: block;
text-align: center;
color: white;
font-size: 50pt;
font-family: fantasy;
}
.title2 {
display: block;
margin-top: 16px;
text-align: center;
color: white;
font-size: 15pt;
font-family: sans-serif;
}
.register {
margin-right: 20px;
display: block;
width: 180px;
height: 50px;
border: 3px solid white;
background-color: rgba(255, 255, 255, 0);
color: white;
font-family: sans-serif;
font-weight: bold;
border-radius: 5px;
transition: background-color 1000ms, color 1000ms;
display: inline-block;
outline: none;
}
.register:hover {
background-color: rgba(255, 255, 255, 1);
color: #222;
cursor: pointer;
transition: background-color 1000ms, color 1000ms;
}
.login {
width: 180px;
height: 50px;
border: 3px solid white;
background-color: rgba(255, 255, 255, 0);
color: white;
font-family: sans-serif;
font-weight: bold;
border-radius: 5px;
transition: background-color 1000ms, color 1000ms;
display: inline-block;
outline: none;
}
.login:hover {
background-color: rgba(255, 255, 255, 1);
color: #222;
cursor: pointer;
transition: background-color 1000ms, color 1000ms;
}
<div class="heading">
<span class="title1">Banerjee Solutions</span>
<span class="title2">Your one stop shop for everything tech.</span>
<div class="btn-container">
<button class="register">REGISTER NOW</button>
<button class="login">LOG IN</button>
</div>
</div>
Here is an updated and working fiddle: https://jsfiddle.net/Ly06krt3/25/
To summarize, you will want to float the LI's left, and give them both a width of 50% which will make them go side-by-side.
You then want add auto to the horizontal margins to align the buttons to the center of the LI's. So something like this: margin: 50px auto.
I am trying to keep the the form elements in one line and as to keep it exactly like this way for all type of resolutions i.e to keep it responsive in the same state but whenever I try to minimize the screen resolution so the form contents get messed up and the Search button goes to the second line as I do not want it to be like that..I simply want it to be in the same state i.e the Search button to stay along next to the input even when the window is minimized so how easily that would be achievable??? As I do know that it can be achieved with the use of CSS Media Queries..!
Here is the GIF :
LIVE PAGE LINK : http://huntedhunter.com/extratorrent/
Here is Code :
HTML :
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div style="padding: 7%;margin-top: 100px;">
<h1>E<span>XTRATORRENT</span> A<span>UTOMATIC</span> D<span>OWNLOADER</span></h1>
<form>
<input class="icon" name="search" placeholder="Search Torrent Name" type="text"> <input class="btn btn-secondary" name="search" type="submit" value="Search">
</form>
</div>
<footer class="footer">
<p>Copyrighted By <strong>Hunted Hunter Solutions</strong>.A Script By <strong>Umair Shah Yousafzai</strong></p>
</footer>
</body>
</html>
CSS :
input[type=text].icon {
width: 89%;
padding: 12px 20px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-image: url(searchicon.png);
background-position: 10px 13px;
background-repeat: no-repeat;
padding-left: 42px;
}
h1 {
font-family: Arial;
opacity: 0.6;
text-align: center;
}
span {
font-size: 70%;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background-color: #eee2e2;
margin-left: -0.5%;
}
body {
overflow-x: hidden;
}
p {
text-align: center;
font-family: Arial;
opacity: 0.7;
}
a {
text-decoration: none;
}
.btn-secondary:hover {
color: #292b2c;
background-color: #e6e6e6;
border-color: #adadad;
cursor: pointer;
}
.btn:focus, .btn:hover {
text-decoration: none;
}
[type=reset], [type=submit], button, html [type=button] {
-webkit-appearance: button;
}
.btn-secondary {
color: #292b2c;
background-color: #fff;
border-color: #adadad;
}
.btn {
border: 1px solid turquoise;
padding: 1.2% 1.5rem;
font-size: 1rem;
border-radius: .25rem;
-webkit-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
You could use a flex-box for this.
Add the .flex class to your <form> tag, along with the rules:
.flex {
display:flex;
flex-wrap:nowrap;
justify-content:center;
}
replace width: 89%; with flex-grow:4; on the input[type=text].icon selector,
Finally add flex-grow:1; and margin-left:5px; to the .btn selector
input[type=text].icon {
flex-grow: 4;
padding: 12px 20px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-image: url(searchicon.png);
background-position: 10px 13px;
background-repeat: no-repeat;
padding-left: 42px;
}
h1 {
font-family: Arial;
opacity: 0.6;
text-align: center;
}
span {
font-size: 70%;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background-color: #eee2e2;
margin-left: -0.5%;
}
body {
overflow-x: hidden;
}
p {
text-align: center;
font-family: Arial;
opacity: 0.7;
}
a {
text-decoration: none;
}
.btn-secondary:hover {
color: #292b2c;
background-color: #e6e6e6;
border-color: #adadad;
cursor: pointer;
}
.btn:focus,
.btn:hover {
text-decoration: none;
}
[type=reset],
[type=submit],
button,
html [type=button] {
-webkit-appearance: button;
}
.btn-secondary {
color: #292b2c;
background-color: #fff;
border-color: #adadad;
}
.btn {
flex-grow: 1;
margin-left: 5px;
border: 1px solid turquoise;
padding: 1.2% 1.5rem;
font-size: 1rem;
border-radius: .25rem;
-webkit-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
.flex {
display: flex;
flex-wrap: nowrap;
justify-content: center;
}
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div style="padding: 7%;margin-top: 100px;">
<h1>E<span>XTRATORRENT</span> A<span>UTOMATIC</span> D<span>OWNLOADER</span></h1>
<form class="flex">
<input class="icon" name="search" placeholder="Search Torrent Name" type="text" /> <input class="btn btn-secondary" name="search" type="submit" value="Search" />
</form>
</div>
<footer class="footer">
<p>Provided without garanties by a <strong>Welldoer</strong>. A Script By <strong>Lars</strong></p>
</footer>
</body>
</html>