How to resize based on zoom or screensize - html

My HTML code:
<div id="divMainFirst">
<div id="divInnerFirst">
<div id="divTitleHeaderUC">
<span id="spanTitleHeaderUC">Urgent Care Wait Time</span>
</div>
<div id="divSubTitleUC">
<div id="smallText" style="padding:0 5px; position: absolute; bottom: 1%; left: 0; right: 0; color: #000000; text-align: center;">If you are experiencing a life-threatening emergency, call 911 or go to your nearest emergency room. Do not go to the urgent care center.<br>Estimated wait times are provided for general information only, may change at any time, and may not reflect your actual wait time once you arrive.</div>
</div>
</div>
<div id="divInnerNext">
<div id="divTitleHeaderFD">
<span id="spanTitleHeaderFD">Find a Doctor</span>
</div>
<div id="divSubTitleFD">
<span style="width: 100%; text-align: center;">
<table cellpadding="5">
<tr>
<td class="alignLeft">By Name [View All]:</td>
</tr>
<tr>
<td style="padding-left: 15px;">
<select>
<option>TEST1</option>
<option>TEST2</option>
</select>
</td>
</tr>
<tr>
<td class="alignLeft">By Specialty [View All]:</td>
</tr>
<tr>
<td style="padding-left: 15px;">
<select>
<option>TEST1</option>
<option>TEST2</option>
</select>
</td>
</tr>
<tr>
<td class="alignLeft">By Location [View All]:</td>
</tr>
<tr>
<td style="padding-left: 15px;">
<select>
<option>TEST1</option>
<option>TEST2</option>
</select>
</td>
</tr>
</table>
</span>
</div>
</div>
</div>
My CSS code:
#divMainFirst {
display: block;
margin: 0 0 0 200px;
overflow: hidden;
}
#divInnerFirst {
display: inline-block;
margin: 0 0 0 100px;
height: 270px;
padding: 0;
width: 265px;
vertical-align: top;
}
#divInnerNext {
display: inline-block;
margin: 0 0 0 50px;
height: 270px;
width: 265px;
vertical-align: top;
}
#divTitleHeaderUC {
width: 265px;
height: 40px;
background-color: #FFFFFF;
text-align: center;
box-shadow: inset 0 0 10px rgba(245, 159, 36, 0.5);
position: relative;
}
#spanTitleHeaderUC {
width: 100%;
height: 40px;
line-height: 40px;
vertical-align: middle;
background-color: #FFFFFF;
font-family: 'blackjarregular';
font-size: 18pt;
color: #F59F24;
font-weight: bold;
}
#divSubTitleUC {
width: 265px;
height: 220px;
background-color: #FFFFFF;
text-align: center;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-webkit-box-shadow: #F59F24 0px 2px 3px;
-moz-box-shadow: #F59F24 0px 2px 3px;
box-shadow: #F59F24 0px 2px 3px;
position: relative;
}
With the above HTML and CSS code, It displays the following zoomed in and by default:
But when I view it in different size screen it changes to this:
As you can see the size of the box hasn't changed and not shrunk to fit all three boxes instead it overflows on to the next section below the first two and cannot be seen.
How can I modify so boxes changes based on the zoom in/screen size?

Have a look into #media queries within your CSS.
With media queries, you can set break points to change the CSS doing things such as hiding certain elements when they're no longer required for the device they're being used on.
Have a look at https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries
That will give you a much more in-depth explanation behind the queries and how to use them effectively.

use percentages for everything. or #media (min-width: 768px) {}

Related

how to make box shadow to be visible through input

Please help me, i am having a tough time with a box shadow, i've been looking for some time now and didn't find a solution
https://jsfiddle.net/4xqavefz/ .input1 / .input2 / .input3
Above is the whole code, in css you are looking for the .input1 ,.input2, and .input3
I am trying to make the box shadow to be seen through the input like below image
image
You could keep the shadow as it is (it falls outside the element) and add in the rest of the coloring with a background-image which is a linear-gradient.
This snippet puts that background-image displaced by 12px (=14px minus a border width).
#font-face {
font-family: futuraptbook;
src: url(../fonts/futuraptbook.ttf);
}
#font-face {
font-family: futuraptdemi;
src: url(../fonts/futuraptbook.ttf);
}
body {
background: black;
}
.block {
display: block;
}
.center {
margin-left: auto;
margin-right: auto;
}
.logo {
width: 185;
height: 161;
}
.p1 {
color: white;
font-size: 24px;
text-align: center;
width: 620px;
height: 63px;
line-height: 32px;
font-family: futuraptbook;
margin-bottom: 100px;
}
.th1 {
color: white;
font-size: 32px;
line-height: 43px;
font-family: futuraptdemi;
padding-bottom: 30px;
}
.age {
font-size: 15px;
text-align: left;
line-height: 20px;
font-family: futuraptdemi;
color: white;
letter-spacing: 1.5px;
}
td input[class^='input'],
td input[class^=" input"] {
width: 176px;
height: 60px;
border: 2px solid #FFFFFF;
background: rgba(0, 0, 0, 0);
background-image: linear-gradient(#54B3A1, #54B3A1);
background-position: 12px 12px;
background-repeat: no-repeat;
box-shadow: 14px 14px 0px 0px #54B3A1;
margin-right: 40px;
color: white;
font-size: 18px;
font-family: futuraptbook;
text-align: center;
}
td input[class^='input']:focus,
td input[class^=" input"] {
box-shadow: 0px 0px 0px 0px black;
width: 218px;
margin-right: -1px;
margin-left: -1px;
border-radius: 0px;
background-image: linear-gradient(transparent, transparent);
}
td input[class^='input']:valid,
td input[class^=" input"] {
box-shadow: 14px 14px 0px 0px #54B3A1;
background-image: linear-gradient(#54B3A1, #54B3A1);
background-position: 12px 12px;
background-repeat: no-repeat;
width: 218px;
margin-right: -1px;
margin-left: -1px;
border-radius: 0px;
}
.btn {
border-radius: 27px;
background: #D94016;
width: 300px;
height: 50px;
margin-top: 50px;
}
.ftr {
position: relative;
text-align: center;
width: 100%;
margin-top: 100px;
margin-bottom: 40px;
}
.under {
text-decoration: none;
position: relative;
}
.under:after {
position: absolute;
content: '';
height: 1px;
bottom: -4px;
width: 75%;
background: #54B3A1;
left: 0px;
}
.logo:hover {
cursor: pointer;
}
.cookiesdiv {
border: 1px solid white;
padding: 10px;
bottom: 0px;
width: 942px;
}
.pcook {
width: 95%;
font-size: 15px;
text-align: left;
color: white;
font-family: futuraptbook;
}
.ckbtn1 {
border-radius: 27px;
background: #54B3A1;
width: 72px;
height: 27px;
color: white;
font-family: futuraptdemi;
font-size: 13px;
}
.ckbtn2 {
border: 1px solid white;
border-radius: 27px;
background: black;
width: 134px;
height: 27px;
color: white;
font-family: futuraptdemi;
font-size: 13px;
}
<html>
<head>
<link rel="stylesheet" href="css/agev.css">
</head>
<body>
<img src="images/viennalogo.png" class="logo center block">
<div>
<p class="p1 center">Welcome! In order to continue your visit on Vienna distribution, you must be of legal drinking age.</p>
</div>
<table class="center">
<tr>
<th colspan="3" class="th1">WHEN WER<span class="under">E Y</span>OU BORN</th>
</tr>
<tr>
<td><label class="age" for="day">DAY (DD)</label></td>
<td><label class="age" for="month">MONTH (MM)</label></td>
<td><label class="age" for="year">YEAR (YYYY)</label></td>
</tr>
<tr>
<td><input type="text" class="input1" name="day" required></td>
<td><input type="text" class="input2" name="month" required></td>
<td><input type="text" class="input3" name="year" required></td>
</tr>
<tr>
<td colspan="3"><button class="btn center block">I AM OF LEGAL DRINKING AGE</button></td>
</tr>
</table>
<footer class="ftr">
<img src="images/facebooklogo.png">
<img src="images/instalogo.png">
<img src="images/twitterlogo.png">
</footer>
<div class="cookiesdiv center">
<table>
<tr>
<td>
<p class="pcook">We use cookies on our website to give you the most relevant experience. By clicking “Accept”, you consent to the use of ALL cookies. Alternatively, you may click “Cookie Settings” to provide a controlled consent.</p>
</td>
<td>
<button class="ckbtn1">ACCEPT</button>
</td>
<td>
<button class="ckbtn2">COOKIE SETTINGS</button>
</td>
</tr>
</table>
</div>
</body>
</html>
Note - to prevent having to repeat the settings for each of the 3 inputs the snippet instead selects by the class beginning with 'input'. You will want to refine that if there is more structure added later to be sure of getting the right elements.
I noted that there was no validation in the sense of making sure that the numbers typed were both numbers and of the right length, but appreciate this is a different question.
The issue is that box-shadow wraps around an element, so you cant use box-shadow here instead you should use an absolute div like in the below example
<td>
<input type="text" class="input1" name="day" required>
<div style="
position: absolute;
width: 80%;
height: 100%;
background: #54b3a1;
top: 16px;
left: 16px;
z-index: 22;
">
</div>
</td>
working example https://jsfiddle.net/ahforcuw/1/

How to fix table width breaking out from div?

Table works normally in 100%, but when I zoom in the table width is not following the screen size. I want to use overflow-scroll to make this work but the scroll bar is not showing.
I don't want to use table-layout fixed with width 100%.
Image below shows the table out of div that makes my upper div (title) going out of div too
HTML
<div id="content">
<div class="breadCrumbs">
<h2 id="breadhead">Report Management</h2>
<div class="clearfix"></div>
</div>
<div class="frameBody p-4 p-md-5 pt-5">
<div class="row">
<div class="col-md-12 tableCover" style="overflow:scroll" >
<table id="tblBranchs" class="table table-bordered " >
<thead>
<tr>
<td >Kode Branch</td>
<td width="5%">Grup</td>
<td >Nama</td>
<td width="20%">Alamat</td>
<td >Bank</td>
<td >Nama Bank</td>
<td >No. Rekening</td>
<td >Kota</td>
<td >Tindakan</td>
</tr>
</thead>
<tbody>
<tr>
<td>12345</td>
<td>12345</td>
<td>12345</td>
<td>123453iuuihefsbefjhsbfjsbfjbsf</td>
<td>12345</td>
<td>12345kl3jhsekfnkljsebf</td>
<td>12345</td>
<td>12345</td>
<td>12345</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
CSS
#content{
width: 100%;
padding: 0;
min-height: 100vh;
transition: all 0.3s;
margin-left: 200px;
}
#breadCrumbs{
padding-top: 4rem;
padding-bottom: 2rem;
padding-left: 3rem;
border-radius: 0px 0px 13px 13px;
box-shadow: 0px 4px #d4d4d6;
}
.table{
width:100%;
}
How to correct this table problem. If i'm using table layout fixed. It shows all table column without scroll but it looks bad
**EDIT
Seems like it's because tableCover width is set 100%. If i set width to (e.g 700px) this is works. But how can make tableCover width following width of the content class width (white screen width) ?
**EDIT 2
The scroll is shown, but why is the table out of div?
This works well if i hide the sidebar, but why it's not responsive when sidebar is active?
Try This
#content
{
width: 100%;
padding: 0;
min-height: 100vh;
transition: all 0.3s;
}
#breadCrumbs
{
padding-top: 4rem;
padding-bottom: 2rem;
padding-left: 3rem;
border-radius: 0px 0px 13px 13px;
box-shadow: 0px 4px #d4d4d6;
}
.table
{
width:100%;
}
Change your CSS code like this:
*,
*:before,
*:after {
box-sizing: border-box;
}
#content{
width: 100%;
padding: 0;
min-height: 100vh;
transition: all 0.3s;
margin-left: 200px;
}
#breadCrumbs{
padding-top: 4rem;
padding-bottom: 2rem;
padding-left: 3rem;
border-radius: 0px 0px 13px 13px;
box-shadow: 0px 4px #d4d4d6;
}
.table {
display: block;
width: 100%;
}

HTML Box - make it look like another website

In this code -
<style>
#boxx{
box-shadow: 0 0 5px 0 rgba(0,0,0,0.3);
border: 6px solid #fff;
background-color: #0e5b93;
min-height: 345px;
max-width: 745 px;
padding-left: 15px;
padding-right: 15px;
}
#ter {
text-align: center;
}
</style>
<div id="boxx">
<table>
<tr>
<td width="500px">
<p style="font-size: 28px; color: #FFF; padding-top: 27px;">Start earning money with your own blog like this one?</p>
<br>
<p style="font-size: 18px; color: #FFF;">This website was created with Thrive Themes and WordPress. Using the suite of tools provided by Thrive Themes is the fastest way for you to create your own website or blog that is <b>fully optimized for maximum conversions</b>. Click the button to get started.</p>
</td>
<td width="251">
<span id="ter" style="width:500px;background:white" onmouseover="this.style.background='gray';" onmouseout="this.style.background='white';">Click Here to Get Thrive Themes</span>
</td>
</tr>
</table>
</div>
I want "Click Here to Get Thrive Themes" box to look like the box on this webpage below-
http://zacjohnson.com/how-will-you-stand-out-from-the-crowd/
What changes I require to make?
I have modified your HTML and CSS a bit to replicate the button in that website you have posted for you.
You can adjust the CSS to suit your exact needs
#boxx {
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.3);
border: 6px solid #fff;
background-color: #0e5b93;
min-height: 345px;
max-width: 745 px;
padding-left: 15px;
padding-right: 15px;
}
a {
color: white;
text-decoration: none;
}
button {
cursor: pointer;
text-align: center;
border-radius: 8px;
border: none;
background-color: #124463;
text-align: center;
-webkit-box-shadow: 0px 2px 0px black;
-moz-box-shadow: 0px 2px 0px black;
box-shadow: 0px 2px 0px black;
width: 150px;
height:80px;
font-weight: 500;
margin-top:150px;
margin-left:20px;
float: right;
font-size:14px;
}
button:hover {
opacity: 0.8;
}
<div id="boxx">
<table>
<tr>
<td width="500px">
<p style="font-size: 28px; color: #FFF; padding-top: 27px;">Start earning money with your own blog like this one?</p>
<p style="font-size: 18px; color: #FFF;">This website was created with Thrive Themes and WordPress. Using the suite of tools provided by Thrive Themes is the fastest way for you to create your own website or blog that is <b>fully optimized for maximum conversions</b>. Click the button
to get started.</p>
</td>
<td>
<button id="ter">Click Here to Get Thrive Themes
</button>
</td>
</tr>
</table>
</div>

Why is this footer not displaced by these floated elements?

What I want is to make my page a little responsive for desktop browsers.
For example, when I decrease the width of the browser, the left and right portion of the page should be stacked over each other. Please check the code, you'll understand. The outerLeft and outerRight div are floated left and right respectively. When I decrease the width of browser, outerRight goes below outerLeft, which is good. But then the problem is with footer and copyright (last two divs at bottom) divs. These do not get displaced because of the outerRight div. I want them to be below outerRight. How can I do this?
HTML:
<body style="margin: 0px">
<div class="outer">
<div id="header"></div>
<div class="outerLeft">
<h1><a style="text-decoration: none; color: white;" href="login.php">WinkCage</a></h1>
<br />
<p>Instant Messaging web application</p>
</div>
<div class="outerRight">
<div class="loginform">
<form name="form2" method="post">
<table>
<tr>
<td><input type="text" name="uname" placeholder="Username" required/></td>
<td><input type="password" name="pass" placeholder="Password" required/></td>
<td><input id="logbutton" type="submit" name="sub" value="Login"/></td>
</tr>
</table>
</form>
<p><?php echo $loginerror; ?></p>
</div>
<div class="signform">
<form id="signupform" name="form1" method="post" enctype="multipart/form-data">
<table>
<tr>
<td><input type="text" name="name" placeholder="Enter your name" required /></td>
<td rowspan="3"><div class="propic"><img id="imgid" src="images/dp.png" /></div>
<input id="imgInput" type="file" name="image" required/></td>
</tr>
<tr>
<td><input type="text" name="username" placeholder="Enter username" required pattern="[a-zA-Z0-9]{6,}" title="The username must contain minimum 6 and ONLY alphanumeric characters."/></td>
</tr>
<tr>
<td><input id="digits" type="text" name="phone" maxlength="10" placeholder="Enter your phone no." pattern=".{10}" required title="Invalid entry. Minimum 10 digits are required."/></td>
</tr>
<tr>
<td><input id="typechange" type="password" name="password" maxlength="12" placeholder="Enter password" required pattern="[a-zA-Z0-9]{5,}" title="The password must contain at least 5 and ONLY alphanumeric characters."/>
<div id="seepass"></div></td>
<td><input type="submit" id="button" name="submit" value="Sign Up"></td>
</tr>
</table>
</form>
<div id="userexist"></div>
<div style="clear: both"></div>
</div>
</div>
<div style="clear: both"></div>
</div>
<div style="font-family: calibri; text-align: center; color: black; font-size: 16px; padding: 5px 0px 5px 0px;"><a style="text-decoration: none; color: black; display: block;" href="login.php">WinkCage © 2016</a></div>
<div style="height: 7px; box-shadow: 0px 0px 1px 1px grey; background-color: white; display: block"></div>
</body>
CSS:
html, body{
height: 100%;
background-color: aquamarine;
}
#header{
height: 20%;
}
.outer{
max-width: 1024px;
margin: 0 auto;
height: 94%;
display: block;
}
.outerLeft{
float: left;
width: 320px;
height: auto;
text-align: center;
margin-top: 145px;
padding-left: 50px;
}
.outerRight{
padding-left: 50px;
float: left;
width: auto;
height: auto;
}
.loginform{
height: auto;
width: 480px;
box-shadow: 0px 0px 15px 0px grey;
border-radius: 3px;
padding: 20px 20px 20px 23px;
background-color: white;
color: red;
}
.loginform input{
width: 187px;
height: 21px;
padding-left: 5px;
}
#logbutton{
background-color: #00CC66;
color: white;
font-weight: bold;
width: 70px;
height: 28px;
cursor: pointer;
}
.signform{
margin-top: 20px;
margin-left: 0px;
height: auto;
width: 480px;
box-shadow: 0px 0px 15px 0px grey;
border-radius: 3px;
padding: 20px 20px 10px 20px;
background-color: white;
}
.signform input{
width: 250px;
height: 24px;
font-size: 20px;
padding: 5px 10px 5px 10px;
margin-bottom: 10px;
}
#button{
background-color: #0099FF;
color: white;
width: 188px !important;
height: 41px !important;
border-radius: 4px;
border: 0px solid grey;
display: block;
font-weight: bold;
margin-left: 10px;
cursor: pointer;
box-shadow: inset 0px 0px 4px grey;
text-shadow: 1px 1px 2px black;
}
.propic{
height: 100px;
width: 100px;
margin: 0 auto;
border: 4px solid white;
box-shadow: 0px 0px 1px 1px grey;
border-radius: 2px;
background-color: grey;
}
#imgInput{
width: 187px !important;
height: 22px !important;
font-size: 14px;
padding: 0px;
margin-top: 10px;
margin-bottom: 10px;
background-color: #cccccc;
margin-left: 10px;
}
#imgid{
height: 100px;
width: 100px;
}
You need to give it a clear: both just this!
<div style="font-family: calibri;text-align: center;color: black;font-size: 16px;padding: 5px 0px 5px 0px;clear: both;"><a style="text-decoration: none; color: black; display: block;" href="login.php">WinkCage © 2016</a></div>
jsFiddle
Note: I suggest you to do not use inline-css
Not sure what you want..
Since you have an element with height 94% - I'd say you always want to see that footer (being fixed on the bottom..) and generate the scroll just for that outer element.
If that's what you want, you can just include an overflow: auto in the .outer class.
.outer {
max-width: 1024px;
margin: 0 auto;
height: 94%;
display: block;
overflow: auto;
}
Take a look here..
https://jsfiddle.net/uvqk4eeL/1/

Positioning image on the page

I have an image in ASP.NET, I hope I can explain this very clearly so you can give very clear answers.
My master form has the following setup:
.page
{
width: auto;
background-color: #fff;
margin: 0px auto 0px auto;
border: 1px solid #496077;
height: auto;
}
.header
{
position: relative;
margin: 0px;
padding: 0px;
background: #4b6c9e;
width: 100%;
}
.header h1
{
font-weight: 700;
margin: 0px;
padding: 0px 0px 0px 20px;
color: #f9f9f9;
border: none;
line-height: 2em;
font-size: 2em;
}
.main
{
padding: 0px 12px;
margin: 12px 8px 8px 8px;
}
.leftCol
{
padding: 6px 0px;
margin: 12px 8px 8px 8px;
width: 200px;
min-height: 200px;
}
.footer
{
color: #4e5766;
padding: 8px 0px 0px 0px;
margin: 0px auto;
text-align: center;
line-height: normal;
}
I have a "contact us" page with variable information about each entry for a person on the left hand margin side of the page (name, address, contact info, etc.). I want to position an image that is just a few pixels past the most far right information given for a certain person, and I want the heightxwidth of the picture to vary based on the height of the text (if the user was to enter more lines for information for each contact person, etc.)
How can I get an image with this positioning? So far I've been able to get an image on the far right side of the screen, but this is not good, as I would like to have 2 columns of contact information for more space on the form.
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<h1>Contact Information<b><img align="left" alt="pic" class="bold"
src="profilepic.jpg"
style="width: 150px; height: 150px; float: right;" vspace="0" /></b></h1>
<b><h2>adsf</h2>
adsf</b> <br />
asdf<br />
asdf</br>
asdf <br />
asdf <br />
asdf
</asp:Content>
have you ever considered using a table? You can style the rows width, text alignment, vertical alignment, and all other styles yadda yadda through using classes; or however you choose. But that will set you up with columns and rows for each person....
<table class="table">
<tr class="tableRow">
<td class="tableDataLeft">
Some Persons info Number 1
</td>
<td class="tableDataMiddle">
Person Number 1's second column of info
</td>
<td class="tableDataRight">
Person number 1's image...<img src/>
</td>
</tr>
<tr>
<tdclass="tableDataLeft">
Some Persons info Number 2
</tdclass="tableDataLeft">
<td class="tableDataMiddle">
Person Number 2's second column of info
</td>
<td class="tableDataRight">
Person number 2's image...<img src/>
</td>
</tr>
</table>