I have a problem here, than I often run into. I have this small landingpage:
Small Landingpage
When I look at the following viewports:
Iphone 6 & 6+ landscape
Ipad portrait and landscape
the form is not fitting.Is that because of bad coding, or is it just like this? Which means that there always will be some editing regarding viewports?
#import url(https://fonts.googleapis.com/css?family=Questrial);
html,
body {
height: 100%;
background: center no-repeat fixed url('../images/bg_1.jpg');
background-size: cover;
color: #444;
font-family: 'Questrial', sans-serif;
}
#media (min-width: 768px) {
h1 {
font-size: 68px;
}
}
a {
color: #999;
}
a:hover {
color: #111;
}
.catchy-text-wrapper {
width: 100%;
text-align: center;
}
#catchyText {
background-color: red;
padding: 20px;
background: rgba(32, 63, 86, 0.8);
display: inline-block;
}
#emailNews {
font-size: 20px;
}
/* Round corners on button */
.btn,
.well,
.panel {
border-radius: 0;
}
.btn-blue {
background: rgba(32, 63, 86, 1.0);
border-color: #5491bd;
border-radius: 10px;
color: #fff;
}
.btn-huge {
padding: 17px 22px;
font-size: 22px;
}
section {
padding-top: 70px;
padding-bottom: 50px;
min-height: 100%;
min-height: calc(100% - 0);
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
}
#section1 {
background-color: rgba(0, 0, 0, 0.6);
color: #fff;
}
/* Form Config */
input {
font-size: 16px;
min-height: 40px;
border-radius: 25px;
line-height: 20px;
padding: 15px 30px 16px;
border: 1px solid #b9b9af;
margin-bottom: 10px;
background-color: #fff;
opacity: 0.9;
-webkit-transition: background-color 0.2s;
transition: background-color 0.2s;
}
.subscribe-input {
float: center;
width: 23%;
height: 5px;
text-align: left;
margin-right: 2px;
}
.btn-placing {
padding-top: 20px;
"
}
#media screen and (max-width: 767px) {
.subscribe-input {
width: 100%;
}
}
<section class="container-fluid" id="section1">
<div class="v-center">
<h1 class="text-center">COMPANY NAME</h1>
<h2 class="text-center">Change this <b>subline</b> here</h2>
<div class="catchy-text-wrapper">
<h2 class="text-center" id="catchyText">A CATCHY PIECE OF TEXT</h2>
</div>
<br>
<p class="text-center"><i id="emailNews">Enter your email for more news</i>
</p>
</div>
<div class="catchy-text-wrapper">
<form role="form" action="register.php" method="post" enctype="plain">
<input type="email" name="email" class="subscribe-input" placeholder="Enter your e-mail address..." required>
</form>
</div>
<p class="text-center btn-placing">
Give me the news
</p>
</section>
Your <input> is displaying at its default box-sizing: content-box, which means that when your
#media screen and (max-width: 767px) {
.subscribe-input {
width: 100%;
}
}
is applied, the content box is getting sized to 100%. Padding is outside the content box, so when you add in the
input {
padding: 15px 30px 16px;
}
your <input> is 60px wider than its container.
Get around this by adding box-sizing: border-box to your input's styles.
Related
Ive been using simple html and css to make my new webpage. its just a gradient background with a gif in front of it. the gif has been giving me a lot of grief lately because it keeps moving out of to the right and extending the scree. i just want the gif to be centered perfectedly and at a good size right not the desktop version looks ideal but the mobile version looks so small as seen below I would just like the gif to be wider and feel the screen more without extending it.
my HTML goes as following
a,
a:focus,
a:hover {
color: #fff;
}
/* Custom default button */
.btn-default,
.btn-default:hover,
.btn-default:focus {
color: #333;
text-shadow: none;
/* Prevent inheritence from `body` */
background-color: #fff;
border: 1px solid #fff;
}
/*
* Base structure
*/
html,
body {
height: 100%;
background-repeat: no-repeat;
background-attachment: fixed;
}
body {
color: #fff;
text-align: center;
text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
background: radial-gradient( circle closest-side, #d5c83d 80%, #e9e5bf, #8482e3);
}
/* Extra markup and styles for table-esque vertical and horizontal centering */
.site-wrapper {
display: table;
width: 100%;
/*height: 100%; */
min-height: 100%;
}
.site-wrapper-inner {
display: table-cell;
vertical-align: top;
}
.cover-container {
margin-right: auto;
margin-left: auto;
}
/* Padding for spacing */
.inner {
padding: 20px;
}
/*
* Header
*/
.masthead-brand {
margin-top: 10px;
margin-bottom: 10px;
}
.masthead-nav>li {
display: inline-block;
}
.masthead-nav>li+li {
margin-left: 20px;
}
.masthead-nav>li>a {
padding-right: 0;
padding-left: 0;
font-size: 30px;
font-weight: bold;
color: #fff;
/* IE8 proofing */
color: rgba(255, 255, 255, .75);
border-bottom: 2px solid transparent;
}
.masthead-nav>li>a:hover,
.masthead-nav>li>a:focus {
background-color: transparent;
border-bottom-color: #a9a9a9;
border-bottom-color: rgba(255, 255, 255, .25);
}
.masthead-nav>.active>a,
.masthead-nav>.active>a:hover,
.masthead-nav>.active>a:focus {
color: #fff;
border-bottom-color: #fff;
}
#media (min-width: 768px) {
.masthead-brand {
float: left;
}
.masthead-nav {
float: right;
}
.jumbotron {
padding-top: calc(var(--jumbotron-padding-y) * 2);
padding-bottom: calc(var(--jumbotron-padding-y) * 2);
}
}
/*
* Cover
*/
.cover {
padding: 0 20px;
}
.cover .btn-lg {
padding: 10px 20px;
font-weight: bold;
}
/*
* Affix and center
*/
#media screen and (max-width: 992px) {}
#media (min-width: 768px) {
/* Pull out the header and footer */
.masthead {
position: fixed;
top: 0;
}
/* Start the vertical centering */
.site-wrapper-inner {
vertical-align: middle;
}
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="container">
<div class="masthead clearfix">
<div class="container inner">
<h3 class="masthead-brand"></h3>
<nav>
<ul class="nav masthead-nav">
<li class="active">Home*</li>
<li>Magazine#</li>
<li>Abouti</li>
</ul>
</nav>
</div>
</div>
<div class="innercover">
<img class="img" src="https://static.tumblr.com/y8b11bc/u05qfybi7/ezgif.com-resize.gif" ; style=" top: 0%; width: 100%; max-height: 100%; " ;></img>
</div>
Adjust your css code to change the size of the GIF depending if it's mobile or desktop. Also, adjust the div that holds the GIF to center the items.
#media (min-width: 768px) {
.img{
width: X%
}
.innercover{
display: flex;
justify-content: center;
align-items: center;
}
I've made a Register template with HTML & CSS. But It isn't responsive at all.
It gets very weird when I try to decrease the browser width, like this.
This Gets Turned into That:
My HTML Code:
<link rel= "stylesheet" type= "text/css" href = "register.css">
<div id="login-box">
<div class="left-box">
<h1>Register</h1>
<form action="#" method="post">
<input type="text" class="txtb" placeholder="Username">
<input type="text" class="txtb" placeholder="Email">
<input type="text" class="txtb" placeholder="Password">
<input type="text" class="txtb" placeholder="Confirm Password">
<input type="submit" value="Sign Up" name="signup-button" class="signup-btn">
</form>
<small class="text-muted ">Already Have An Account?Login</small>
</div>
<div class="right-box">
</div>
</div>
My CSS Code:
body
{
margin: 0;
padding: 0;
font-size: 16px;
color: #777;
font-family: sans-serif;
font-weight: 300;
background-image: url(images/image.jpg);
background-size: cover;
background-position: center;
}
#login-box
{
position: relative;
height: 430px;
width: 630px;
background: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
transform: translate(45%, 14%);
}
.left-box
{
position: absolute;
top: 0;
right: 0;
box-sizing: border-box;
padding: 40px;
width: 300px;
height: 430px;
}
h1
{
margin: -10px 0 20px 0;
font-weight: 300;
font-size: 28px;
}
input.txtb
{
display: block;
box-sizing: border-box;
margin-bottom: 26px;
padding: 4px;
width: 220px;
height: 34px;
border: none;
outline: none;
border-bottom: 1px solid #aaa;
font-family: sans-serif;
font-weight: 400;
font-size: 15px;
transition: 0.2s ease;
}
input[type="submit"]
{
height: 32px;
width: 47%;
margin-top: 10px;
margin-bottom: 20px;
background: transparent;
border-radius: 44px;
cursor: pointer;
transition: 0.6s;
border-style: none;
background-image: linear-gradient(-20deg, #fc6076 0%, #ff9a44 100%);
color: white;
}
input[type="submit"]:hover,
input[type="submit"]:focus
{
transform: scale(1.04);
}
.right-box
{
position: absolute;
top: 0;
left: 0;
box-sizing: border-box;
padding: 40px;
width: 315px;
height: 430px;
background-image: url(images/bg.png);
background-size: cover;
background-position: center;
}
small a
{
margin-left: 4px;
}
small a:hover
{
text-decoration: none;
}
#-webkit-keyframes autofill {
to {
color: black;
background: transparent;
}
}
.txtb:-webkit-autofill {
-webkit-animation-name: autofill;
-webkit-animation-fill-mode: both;
}
How Can I Avoid this and set a limit to screen minimize or just show something else when the browser width is decreased?
Thanks In Advance!
You will want to put a media query within your css declaration.
#media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
This example will give any device, that is 600px wide or less, a lightblue background.
Have you tried using Bootstrap? it's not that hard, it works great and theres a lot of documentation online and people on SO that can help you too. Here's a link to get you started: https://getbootstrap.com/
In a nutshell, bootstrap is a tool that helps you make simple websites responsive so they can scale between devices. In actuality it's a little more complcated than this but nothing to worry about.
I am using algolia autocomplete in my app. And I would like to build a search bar that expands like the expandable example on this page. I have a layout with a header bar that has a search input for bigger screens. On small screens I only have a magnifying glass icon, that on click toggles another header with a search bar, that I initially have it hidden. Here is the fiddle, which I wasn't able to get working, but hope it can still give you some overview. This is the layout:
<header class="mdc-toolbar mdc-toolbar--fixed toolbar--custom">
<div class="mdc-toolbar__row">
<section class="menu mdc-toolbar__section mdc-toolbar__section--align-start">
menu
<span class="mdc-toolbar__title">Title</span>
</section>
<section class="mdc-toolbar__section">
<form action="/search" method="get" class="search-field-desktop">
<div class="mdc-text-field mdc-text-field--box mdc-text-field--with-leading-icon autocomplete-search-field">
<i class="material-icons mdc-text-field__icon" tabindex="0">search</i>
<input name="q"
type="text"
class="mdc-text-field__input search-input-js aa-input-search"
placeholder="Search for players and videos ..."
aria-label="Full-Width Text Field">
</div>
</form>
</section>
<section class="mdc-toolbar__section mdc-toolbar__section--align-end" role="toolbar">
search
more_vert
</section>
</div>
</header>
<header class="search-field-phone mdc-toolbar mdc-toolbar--fixed toolbar--custom">
<div class="mdc-toolbar__row">
<a id="search-input-close" class="material-icons mdc-toolbar__menu-icon" tabindex="0">arrow_back</a>
<form action="/search" method="get">
<div class="mdc-text-field mdc-text-field--box autocomplete-search-field">
<input name="q"
type="text"
class="mdc-text-field__input search-input-js aa-input-search"
placeholder="Search for players and videos ..."
aria-label="Full-Width Text Field"
autofocus>
</div>
</form>
</div>
</header>
The problem I have is that the dropdown menu is not visible on small screens for some reason and on bigger screens it is. This is the scss/css:
.algolia-autocomplete {
display: flex!important;
flex: auto!important;
height: 100%;
}
.aa-dropdown-menu {
position: relative;
top: -6px;
border-radius: 3px;
margin: 6px 0 0;
padding: 0;
text-align: left;
height: auto;
position: relative;
background: $white;
border: 1px solid #ccc;
width: 100%;
left: 0 !important;
box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.2), 0 2px 3px 0 rgba(0, 0, 0, 0.1);
}
.aa-dropdown-menu .aa-suggestions {
position: relative;
z-index: 1000;
}
.aa-dropdown-menu [class^="aa-dataset-"] {
position: relative;
border: 0;
border-radius: 3px;
overflow: auto;
padding: 0;
color: #3c3e42;
font-weight: 500;
}
.aa-dropdown-menu * {
box-sizing: border-box;
}
.aa-suggestion {
display: block;
width: 100%;
height: 72px;
clear: both;
.mdc-list-item {
height: 72px;
}
}
.aa-suggestion span {
white-space: nowrap !important;
text-overflow: ellipsis;
overflow: hidden;
display: block;
float: left;
line-height: 1em;
width: calc(100% - 30px);
}
.aa-suggestion.aa-cursor {
background-color: transparent;
}
.aa-suggestion em {
color: #00bcd4;
font-weight: 700;
}
.aa-suggestion img {
float: left;
height: 44px;
width: 44px;
margin-right: 6px;
}
.aa-suggestion a {
color: #3c3e42;
}
.aa-suggestions-category {
font-weight: 700;
color: #3c3e42;
border-bottom: 1px solid rgba(102, 105, 105, 0.17);
}
.powered-by-algolia {
padding-left: 15px;
border-top: 1px solid rgba(102, 105, 105, 0.17);
display: flex;
align-items: center;
height: 30px;
}
.aa-input-container {
display: inline-block;
position: relative; }
.aa-input-search {
width: 100%;
height: 30px;
padding: 12px 28px 12px 12px;
box-sizing: border-box;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none; }
.aa-input-search::-webkit-search-decoration,
.aa-input-search::-webkit-search-cancel-button,
.aa-input-search::-webkit-search-results-button,
.aa-input-search::-webkit-search-results-decoration {
display: none;
}
.media {
margin: 10px 0;
}
.media-body {
p {
margin: 0;
}
}
.toolbar--custom {
color: $white;
.mdc-toolbar__row {
min-height: 56px;
}
form, .autocomplete-search-field {
width: 100%;
}
.mdc-text-field--box:not(.mdc-text-field--upgraded) {
height: 36px;
}
.mdc-text-field--box {
overflow: visible;
margin: auto;
.mdc-text-field__icon {
bottom: 8px;
font-size: 22px;
}
}
.mdc-text-field--box:after,
.mdc-text-field--box:before {
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#search-input-open {
display: none;
}
#media only screen and (max-width: 782px) {
#search-input-open {
display: block;
}
.search-field-desktop {
display: none;
}
}
}
.search-field-phone {
clip-path: circle(0%);
visibility: hidden;
.mdc-text-field {
clip-path: circle(0%);
}
}
#mixin search-animated-open {
-webkit-animation: open 0.3s forwards;
animation: open 0.3s forwards;
animation-timing-function: $mdc-animation-standard-curve-timing-function;
}
#mixin search-animated-close {
-webkit-animation: close 0.3s forwards;
animation: close 0.3s forwards;
animation-timing-function: $mdc-animation-standard-curve-timing-function;
}
.search-field-phone-open, {
visibility: visible;
#include search-animated-open;
.mdc-text-field {
#include search-animated-open;
}
}
.search-field-phone-close, {
#include search-animated-close;
.mdc-text-field {
#include search-animated-close;
}
}
#keyframes open {
from {
clip-path: circle(0 at calc(100% - 68px) 50%);
}
to {
clip-path: circle(150% at calc(100% - 68px) 50%);
}
}
#keyframes close {
from {
clip-path: circle(150% at calc(100% - 68px) 50%);
}
to {
clip-path: circle(0 at calc(100% - 68px) 50%);
visibility: hidden;
}
}
The layout of the whole page looks like this:
<div id="app">
#include('layouts.partials.sidebar')
#include('layouts.partials.navigation')
<div class="page-content">
#yield('content')
</div>
</div>
Where the navigation partial is the file with headers shown above. This is the sidebar partial:
<aside class="mdc-drawer mdc-drawer--temporary mdc-typography">
<nav class="mdc-drawer__drawer">
<header class="mdc-drawer__header">
<div class="mdc-drawer__header-content">
Header here
</div>
</header>
<nav id="icon-with-text-demo" class="mdc-drawer__content mdc-list">
<a class="mdc-list-item mdc-list-item--activated" href="#">
<i class="material-icons mdc-list-item__graphic" aria-hidden="true">inbox</i>Inbox
</a>
<a class="mdc-list-item" href="#">
<i class="material-icons mdc-list-item__graphic" aria-hidden="true">star</i>Star
</a>
</nav>
</nav>
</aside>
This is the css for the page:
body {
margin: 0;
}
#app {
display: flex;
}
.page-content {
display: inline-flex;
flex-direction: column;
flex-grow: 1;
height: 100%;
box-sizing: border-box;
}
I am not sure what is causing this behaviour, why is the dropdown menu for bigger screens visible, and the one for smaller screens not?
Update
I have noticed that when I have opened search input on small screens, if I remove the search-field-phone-open then the dropdown menu is visible, I am not sure what is in that class causing that the dropdown is not visible?
.search-field-phone-open, {
visibility: visible;
#include search-animated-open;
.mdc-text-field {
#include search-animated-open;
}
}
I am not sure I understood what you need but check the snippet below:
var client = algoliasearch('latency', '6be0576ff61c053d5f9a3225e2a90f76');
var index = client.initIndex('contacts');
$('.input-search').autocomplete({ hint: false }, [
{
source: function(searchBar, cb) {
index.search(searchBar, { hitsPerPage: 5 }, function(error, content) {
if (error) {
cb([]);
return;
}
cb(content.hits, content);
});
},
displayKey: 'name',
templates: {
suggestion: function(suggestion) {
return suggestion._highlightResult.name.value;
}
}
}
]);
.algolia-autocomplete {
display: flex!important;
flex: auto!important;
height: 100%;
}
.aa-dropdown-menu {
position: relative;
top: -6px;
border-radius: 3px;
margin: 6px 0 0;
padding: 0;
text-align: left;
height: auto;
position: relative;
background: $white;
border: 1px solid #ccc;
width: 100%;
left: 0 !important;
box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.2), 0 2px 3px 0 rgba(0, 0, 0, 0.1);
}
.aa-dropdown-menu:before {
position: absolute;
content: '';
width: 14px;
height: 14px;
background: #fff;
z-index: 0;
top: -7px;
border-top: 1px solid #D9D9D9;
border-right: 1px solid #D9D9D9;
transform: rotate(-45deg);
border-radius: 2px;
z-index: 999;
display: block;
left: 24px;
}
.aa-dropdown-menu .aa-suggestions {
position: relative;
z-index: 1000;
}
.aa-dropdown-menu [class^="aa-dataset-"] {
position: relative;
border: 0;
border-radius: 3px;
overflow: auto;
padding: 8px 8px 8px;
color: #3c3e42;
font-weight: 500;
}
.aa-dropdown-menu * {
box-sizing: border-box;
}
.aa-suggestion {
padding: 0 4px 0;
display: block;
width: 100%;
height: 38px;
clear: both;
}
.aa-suggestion span {
white-space: nowrap !important;
text-overflow: ellipsis;
overflow: hidden;
display: block;
float: left;
line-height: 1em;
width: calc(100% - 30px);
}
.aa-suggestion.aa-cursor {
background-color: transparent;
}
.aa-suggestion em {
color: #00bcd4;
font-weight: 700;
}
.aa-suggestion img {
float: left;
height: 44px;
width: 44px;
margin-right: 6px;
}
.aa-suggestion a {
color: #3c3e42;
}
.aa-suggestions-category {
font-weight: 700;
color: #3c3e42;
border-bottom: 1px solid rgba(102, 105, 105, 0.17);
}
.mdl-textfield {
margin: -20px !important;
}
/* fallback */
#font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/materialicons/v36/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-moz-font-feature-settings: 'liga';
-moz-osx-font-smoothing: grayscale;
}
<link href="https://storage.googleapis.com/code.getmdl.io/1.0.1/material.teal-red.min.css" rel="stylesheet"/>
<link href="https://unpkg.com/material-components-web#0.8.0/dist/material-components-web.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/algoliasearch/3/algoliasearch.min.js"></script>
<script src="https://cdn.jsdelivr.net/autocomplete.js/0/autocomplete.jquery.min.js"></script>
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.1/material.min.js"></script>
<script src="https://unpkg.com/material-components-web#0.8.0/dist/material-components-web.min.js"></script>
<header class="mdc-toolbar">
<div class="mdc-toolbar__row">
<section class="mdc-toolbar__section mdc-toolbar__section--align-start">
menu
<span class="mdc-toolbar__title">Title</span>
</section>
<section class="mdc-toolbar__section">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable">
<label class="mdl-button mdl-js-button mdl-button--icon" for="site-search">
<i class="material-icons">search</i>
</label>
<div class="mdl-textfield__expandable-holder">
<input class="mdl-textfield__input input-search" name="searchBar" type="search" id="site-search" />
<label class="mdl-textfield__label" for="site-search">Search</label>
</div>
</div>
</section>
<section class="mdc-toolbar__section mdc-toolbar__section--align-end">
Custom icon
</section>
</div>
</header>
Hope this helps you.
References
I referred to mdc-toolbar available on GitHub.
Im a beginner for the bootstrap, some text are every where, how can i set it
Im trying to make some application its is not a working for all of mobile devices,its only working for iPhone 6+ and nexus 6p
how can i fix it??
html
<div class="progress-bar position" data-percent="48" data-duration="1000" data-color="#63676e,#ec9850"><script>$(".progress-bar").loading();</script></div>
<div id="Main">
<h2 class="text-color-header">Room Utilization</h2>
<h5 class="text-header">9 rooms occupied today</h5>
<div id="container">
<div class="block block-1">
<h1>$ 2,300</h1>
<h5>Today Revenue</h5>
</div>
<div class="block block-2">
<h1>$ 12,100</h1>
<h5>Reservation for next 15 days</h5>
</div>
<div class="block block-3">
<h1>$ 41,000</h1>
<h5>Revenue Todate / Month</h5>
</div>
<div class="block block-4">
<h1>$ 53,100</h1>
<h5>Expected Revenue for this month</h5>
</div>
<!--Menu Part 02-->
<div id="base">
<div class="base-block">
<h4>Payments</h4>
<h1>$ 2,000</h1>
<h5>5 check-outs today</h5>
</div>
<div class="base-block">
<h4>Down Payments</h4>
<h1>$ 300</h1>
<h5>2 Bokings withdown payments</h5>
</div>
</div>
<!-- End of menu Part-->
</div>
</div>
css
body{webkit-overflow-scrolling: touch;}
.text-color-header { margin-top: 250px;}
/* Progress Bar */
.progress-bar {
text-align: center;
height: 150px;
width: 150px;
margin-left: 100px;
}
.progress-bar {
float: left;
width: 0;
height: 100%;
font-size: 12px;
line-height: 20px;
color: #fff;
text-align: center;
-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
-webkit-transition: width .6s ease;
-o-transition: width .6s ease;
transition: width .6s ease;
}
.progress-bar div {
position: absolute;
height: 200px;
width: 200px;
border-radius: 50%;
}
.progress-bar div span {
position: absolute;
font-family: Arial;
font-size: 35px;
line-height: 175px;
height: 175px;
width: 175px;
left: 12.5px;
top: 12.5px;
text-align:center;
border-radius: 50%;
background-color:#e0e0e0;
color: black;
}
.progress-bar .background {
background-color: #b3cef6;
}
.progress-bar .rotate {
clip: rect(0 100px 200px 0);
background-color: #4b86db;
}
.progress-bar .left {
clip: rect(0 100px 200px 0);
opacity: 1;
background-color: #b3cef6;
}
.progress-bar .right {
clip: rect(0 100px 200px 0);
transform: rotate(180deg);
opacity: 0;
background-color: #4b86db;
}
#keyframes toggle {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
/*End of Progress Bar*/
.page {
margin: 0px auto;
display: flex;
}
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
.clearfix {
display: inline-block;
margin: 0px auto;
}
h5,
.h5 {
font-size: 13px;
text-align: center;
}
.block {
width: 200px;
height: 100px;
margin: 1px;
display: inline-block;
background: ;
color: #d4c4b6;
}
.block:hover h1 {
color: #000000;
}
.block:hover h5 {
color: #A48973;
}
#base {
background: #e2e2e2;
display: inline-block;
height: 120px;
margin-left: 0px;
margin-top: -7px;
position: relative;
width: auto;
}
#base:before {
border-bottom: 35px solid #e2e2e2;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
content: "";
height: 0;
left: 173px;
position: absolute;
top: -20px;
width: 0;
}
h1,
.h1 {
font-size: 27px;
text-align: center;
}
h2,
.h2 {
font-size: 20px;
text-align: center;
}
h4,
.h4 {
font-size: 16px;
text-align: center;
}
.base-block {
display: inline-block;
height: 120px;
width: 200px;
margin: 1px;
display: inline-block;
}
.base-block h1,
h4 {
color: #000000;
}
.base-block h5 {
color: #A48973;
}
.navbar-default .navbar-brand {
color: #A48973;
}
.navbar-default .navbar-toggle {
border: none;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #A48973;
}
.search-bar {
padding: 7px 15px;
}
/*Start Media query*/
#media (max-width: 768px) {
.form-control {
padding: 6px 100px;
}
}
/*End Of Media query*/
Use bootstrap grid layout classes col-xs-6 for div's instead of block-1, block-2. In your css, set width and height in percentages instead of numbers in px.
Also, try not to set height, instead set width.
Use classes like panel and panel-body in each div.
Put entire content in
<div class="container-fluid">
//Create three rows
<div class="row">
//create 2 divs with class col-xs-6
</div>
<div class="row">
//create 2 divs with class col-xs-6
</div>
<div class="row">
//create 2 divs with class col-xs-6
</div>
</div>
I couldn't add a comment so I'll just compound with Amit's answer. Make sure this
<meta name="viewport" content="width=device-width, initial-scale=1" /> is in your head tags as well. It set you page viewport size to the px size of device. Without it the code Amit suggested won't work. All in all your not actually using any Bootstrap in your code. I would also recommend looking through this to get a true understanding of Bootstrap https://www.w3schools.com/bootstrap
I am completely stumped on an issue I am having. It is the simplest issue, but I just can't locate the issue. I have a line of text with a border around it to act as a button. I increased the text within this and since then half of the text jumps to the next line whenever the viewport is lower than 1200px.
I created a snippet to replicate this, but even that won't help, so this most likely has to be seen live. The area the issue is at is in the "Grow your business with us" section at the very bottom of that section (under the 3 images).
Please view it in a viewport of less than 1200px
What is causing the self made button to be on 2 lines? I have the width set to 100%?
$(function() {
$('#see-all-services-text').animate({
opacity: 1,
left: '0%'
}, 700);
})
#home-img-block-section {
width: 100%;
height: 850px;
}
#see-all-services {
width: 100%;
height: 75px;
text-align: center;
}
#see-all-services-text {
opacity: 0;
font-size: 1.3em;
position: relative;
left: -30%;
}
#see-all-services-text a {
text-decoration: none;
color: #45a5ba;
cursor: pointer;
}
#see-all-services-button {
padding: 15px 20px;
border: 2px solid #45a5ba;
transition: ease-in-out .5s;
}
#see-all-services-button:hover {
border: 2px solid #45a5ba;
color: #FFF;
background: #45a5ba;
transition: ease-in-out .5s;
}
/*---------------------------------------------- MEDIA QUERY 961 - 1200--------------------------*/
#media screen and (min-width: 961px) and (max-width: 1200px) {
#home-img-block-section {
height: 670px;
}
#see-all-services-text {
font-size: 1.2em;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="home-img-block-section">
<div id="see-all-services">
<div id="see-all-services-text"><span id="see-all-services-button">VIEW ALL WEB DESIGN SERVICES</span></div>
</div>
</div>
It's happening because your button is inline element. Set display:inline-block; to it and remove width:100%;, and everything should be ok.
Your snippet:
$(function() {
$('#see-all-services-text').animate({
opacity: 1,
left: '0%'
}, 700);
})
#home-img-block-section {
width: 100%;
height: 850px;
}
#see-all-services {
width: 100%;
height: 75px;
text-align: center;
}
#see-all-services-text {
opacity: 0;
font-size: 1.3em;
position: relative;
left: -30%;
}
#see-all-services-text a {
text-decoration: none;
color: #45a5ba;
cursor: pointer;
}
#see-all-services-button {
padding: 15px 20px;
display: inline-block;
border: 2px solid #45a5ba;
transition: ease-in-out .5s;
}
#see-all-services-button:hover {
border: 2px solid #45a5ba;
color: #FFF;
background: #45a5ba;
transition: ease-in-out .5s;
}
/*---------------------------------------------- MEDIA QUERY 961 - 1200--------------------------*/
#media screen and (min-width: 961px) and (max-width: 1200px) {
#home-img-block-section {
height: 670px;
}
#see-all-services-text {
font-size: 1.2em;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="home-img-block-section">
<div id="see-all-services">
<div id="see-all-services-text"><span id="see-all-services-button">VIEW ALL WEB DESIGN SERVICES</span></div>
</div>
</div>