Image responsiveness breaks in 320x568 - html

My Code is like this
.fairdetailimg {
margin-bottom: 20px;
}
.fairmonos {
border: 1px solid #ddd;
}
table {
background-color: transparent;
}
table {
border-spacing: 0;
border-collapse: collapse;
}
* {
padding: 0;
margin: 0;
}
.fairmonos td {
vertical-align: top;
}
.fairdet-image, .fairdet-image img {
width: 100%;
overflow: hidden;
}
img {
vertical-align: middle;
}
img {
border: 0;
}
#media screen and (min-width: 1025px)
responsive.css:1800
td.fair-border {
vertical-align: middle;
}
td.fair-border {
vertical-align: middle;
width: 30% !important;
word-break: break-word;
}
.fair-border {
border: 1px solid #ddd;
}
.fair-mono {
text-align: center;
font-size: 25px;
margin-bottom: 15px;
font-weight: 400;
}
.fairmonos .fair-img {
width: 60%;
margin: 10px auto;
padding-top: 0px;
overflow: hidden;
}
<div class="fairdetailimg">
<table width="100%" class="fairmonos">
<tbody>
<tr>
<td width="70%">
<div class="fairdet-image">
<img src="https://preview.ibb.co/nkY9oF/1.jpg">
</div>
</td>
<td class="fair-border" width="30%">
<div class="fair-logoinfo">
<div class="fair-mono">
India Art Fair
</div>
<div class="fair-img">
<a href="#">
<img class="img-responsive" src="https://image.ibb.co/czDaTF/2.jpg">
</a>
</div>
<div class="fair-address">
<strong>Address: </strong>INDIA
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="clearfix"></div>
</div>
Everything works fine in higher resolutions but when it goes to lower resolutions it creates a white gap below main image as shown in the pic
How can I overcome this?

I did a few edits just check below.
This is where Photoshop is useful i would say. I would create the image and then make my divs accordingly as some images which tend to get stretched don't look great at all.
.fairdetailimg {
/*margin-bottom: 20px;*/
}
.fairmonos {
border: 1px solid #ddd;
}
table {
background-color: transparent;
}
table {
border-spacing: 0;
border-collapse: collapse;
}
* {
padding: 0;
margin: 0;
}
.fairmonos td {
vertical-align: top;
}
.fairdet-image, .fairdet-image img {
width: 100%;
height: 380px;
overflow: hidden;
}
.fair-img{
width: 100%;
}
img {
vertical-align: middle;
}
img {
border: 0;
}
#media screen and (min-width: 1025px)
responsive.css:1800
td.fair-border {
vertical-align: middle;
}
td.fair-border {
vertical-align: middle;
width: 30% !important;
word-break: break-word;
}
.fair-border {
border: 1px solid #ddd;
}
.fair-mono {
text-align: center;
font-size: 25px;
margin-bottom: 15px;
font-weight: 400;
}
.fairmonos .fair-img {
width: 60%;
margin: 10px auto;
padding-top: 0px;
overflow: hidden;
}
<div class="fairdetailimg">
<table width="100%" class="fairmonos">
<tbody>
<tr>
<td width="40%">
<div class="fairdet-image">
<img src="https://preview.ibb.co/nkY9oF/1.jpg">
</div>
</td>
<td class="fair-border" width="30%">
<div class="fair-logoinfo">
<div class="fair-mono">
India Art Fair
</div>
<div class="fair-img">
<a href="#">
<img class="img-responsive" src="https://image.ibb.co/czDaTF/2.jpg">
</a>
</div>
<div class="fair-address">
<strong>Address: </strong>INDIA
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="clearfix"></div>
</div>

Because your image is responsive, you can either add a height to your image but this approach will make your image distorted.
EXAMPLE 1
.fairdetailimg {
margin-bottom: 20px;
}
.fairmonos {
border: 1px solid #ddd;
}
table {
background-color: transparent;
}
table {
border-spacing: 0;
border-collapse: collapse;
}
* {
padding: 0;
margin: 0;
}
.fairmonos td {
vertical-align: top;
}
.fairdet-image, .fairdet-image img {
width: 100%;
height: 500px;
overflow: hidden;
}
img {
vertical-align: middle;
}
img {
border: 0;
}
#media screen and (min-width: 1025px)
responsive.css:1800
td.fair-border {
vertical-align: middle;
}
td.fair-border {
vertical-align: middle;
width: 30% !important;
word-break: break-word;
}
.fair-border {
border: 1px solid #ddd;
}
.fair-mono {
text-align: center;
font-size: 25px;
margin-bottom: 15px;
font-weight: 400;
}
.fairmonos .fair-img {
width: 60%;
margin: 10px auto;
padding-top: 0px;
overflow: hidden;
}
<div class="fairdetailimg">
<table width="100%" class="fairmonos">
<tbody>
<tr>
<td width="70%">
<div class="fairdet-image">
<img src="https://preview.ibb.co/nkY9oF/1.jpg">
</div>
</td>
<td class="fair-border" width="30%">
<div class="fair-logoinfo">
<div class="fair-mono">
India Art Fair
</div>
<div class="fair-img">
<a href="#">
<img class="img-responsive" src="https://image.ibb.co/czDaTF/2.jpg">
</a>
</div>
<div class="fair-address">
<strong>Address: </strong>INDIA
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="clearfix"></div>
</div>
Or using background image with background-cover property
EXAMPLE 2
.fairdetailimg {
margin-bottom: 20px;
}
.fairmonos {
border: 1px solid #ddd;
}
table {
background-color: transparent;
}
table {
border-spacing: 0;
border-collapse: collapse;
}
* {
padding: 0;
margin: 0;
}
.fairmonos td {
vertical-align: top;
}
.fairdet-image, .fairdet-image img {
background: url('https://preview.ibb.co/nkY9oF/1.jpg') no-repeat center center / cover;
width: 100%;
height: 500px;
overflow: hidden;
}
img {
vertical-align: middle;
}
img {
border: 0;
}
#media screen and (min-width: 1025px)
responsive.css:1800
td.fair-border {
vertical-align: middle;
}
td.fair-border {
vertical-align: middle;
width: 30% !important;
word-break: break-word;
}
.fair-border {
border: 1px solid #ddd;
}
.fair-mono {
text-align: center;
font-size: 25px;
margin-bottom: 15px;
font-weight: 400;
}
.fairmonos .fair-img {
width: 60%;
margin: 10px auto;
padding-top: 0px;
overflow: hidden;
}
<div class="fairdetailimg">
<table width="100%" class="fairmonos">
<tbody>
<tr>
<td width="70%">
<div class="fairdet-image">
</div>
</td>
<td class="fair-border" width="30%">
<div class="fair-logoinfo">
<div class="fair-mono">
India Art Fair
</div>
<div class="fair-img">
<a href="#">
<img class="img-responsive" src="https://image.ibb.co/czDaTF/2.jpg">
</a>
</div>
<div class="fair-address">
<strong>Address: </strong>INDIA
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="clearfix"></div>
</div>

Related

Trying to Align and make Responsive an Online Form in Netsuite (HTML/CSS)

I've been trying to design an Online form for our customers to upload their prescriptions. I've created the below in Dreamweaver, I'm not a programmer as you will see below but I've given it my shot to make this work and probably added too many things then needed lol. I just followed some of the online tutorials and probably messed up somewhere.
If you run the link at the bottom, you will see it's misaligned (Top, the 'please enter you details text and the form fields'). I've tried padding it quite a lot and of course responsive doesn't work).
I hope you can help. (I apologise if I posted this in the wrong section).
table {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
}
.topnav {
float: left;
text-align: left;
padding-left: 200px;
padding-right: 200px;
text-decoration: none;
}
.fields {
float: left;
padding-left: 200px;
padding-right: 200px;
text-align: left text-decoration: none;
}
* {
box-sizing: border-box;
}
#column_container {
width: 837px;
margin: 0 auto;
}
<div class="topnav" id="myTopnav">
<table width="900" cellpadding="30">
<tbody>
<tr>
<td>
<img src="http://themedicalsupplydepot.com/email/logo.jpg" width="183" height="95" alt="Medical Supply Depot">
</td>
<td>
<img src="https://secure.medicalsupplydepot.com/site/img/verisign_l.gif" alt="Norton SECURED Powered by VeriSign">
<br>
<a style="padding-left: 3px;" href="https://www.mcafeesecure.com/RatingVerify?ref=www.medicalsupplydepot.com"><img src="https://images.scanalert.com/meter/www.medicalsupplydepot.com/13.gif" alt="McAfee SECURE sites help keep you safe from identity theft, credit card fraud, spyware, spam, viruses and online scams" oncontextmenu="alert('Copying Prohibited by Law - McAfee Secure is a Trademark of McAfee, Inc.'); return false;"
border="0" height="54" width="94"></a>
</td>
<td>
<table cellpadding="0" cellspacing="0" align="left" width="200">
<tbody>
<tr>
<td><img src="http://themedicalsupplydepot.com/email/telephone.jpg" width="29" height="29"></td>
<td style="font-size:21px; font-weight:bold; color:#536f86">(800) 965-7496</td>
</tr>
<tr>
<td><img src="http://themedicalsupplydepot.com/email/clock.jpg" width="29" height="29"></td>
<td style="font-size:12px; font-weight:bold; color:#333333; padding-top:4px">Monday through Friday, <br>9am to 9pm (Eastern Time)</td>
</tr>
<tr>
<td><img src="http://themedicalsupplydepot.com/email/contact.jpg" width="29" height="29"></td>
<td style="font-size:11px; font-weight:bold;">info#medicalsupplydepot.com</td>
</tr>
</tbody>
</table>
<br><br>
<NLFORM>
</td>
</tr>
</tbody>
</table><br></div>
<br /><br />
<div class="fields" id="fields">
<h2>Please fill in the details:</h2>
<table width="100" cellpadding="1">
<tr>
<td>
<nlsalutation></nlsalutation>
</td>
<td>
<nladdress1></nladdress1>
</td>
</tr>
<tr>
<td>
<nlfirstname></nlfirstname>
</td>
<td>
<nladdress2></nladdress2>
</td>
</tr>
<tr>
<td>
<nllastname></nllastname>
</td>
<td>
<nladdress3></nladdress3>
</td>
</tr>
<tr>
<td>
<nlemail></nlemail>
</td>
<td>
<nlstate></nlstate>
</td>
</tr>
<tr>
<td>
<nlphone></nlphone>
</td>
<td>
<nlzipcode></nlzipcode>
</td>
</tr>
<tr>
<td>
<nlfile></nlfile>
</td>
<td></td>
</tr>
<tr>
<td>
<nlcomments></nlcomments>
</td>
<td> </td>
</tr>
</table>
</div>
This is the actual form Online Form. The fields added are part of the Netsuite system so they won't show up on Dreamweaver or Notepad++, or whatever else you guys use.
Based on your HTML I have added the minimum amount of CSS to make this responsive and keep in line your inputs. Also, added CSS to allow you to control style of each element. I still recommend finding a method for adding a framework (https://getbootstrap.com/ is my favourite) to your NetSuite pages. This will most likely suffice, but won't evolve with new screens and devices in the same way a popular framework would with updates.
Anyhow, let me know how you go with this and if you have any questions, just ask.
html,
body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
left: 0;
top: 0;
font-size: 100%;
background: #f9fafb;
}
/* FONT STYLES */
* {
font-family: Arial, Helvetica, sans-serif;
color: #193652;
line-height: 1.5;
}
h2 {
font-size: 2rem;
}
/* GRID */
.container {
width: 90%;
margin-left: auto;
margin-right: auto;
}
.row {
position: relative;
width: 100%;
}
.row [class^="col"] {
float: left;
margin: 0.5rem 2%;
min-height: 0.125rem;
}
.col-1,
.col-2,
.col-3,
.col-4,
.col-5,
.col-6,
.col-7,
.col-8,
.col-9,
.col-10,
.col-11,
.col-12 {
width: 96%;
}
.col-1-sm {
width: 4.33%;
}
.col-2-sm {
width: 12.66%;
}
.col-3-sm {
width: 21%;
}
.col-4-sm {
width: 29.33%;
}
.col-5-sm {
width: 37.66%;
}
.col-6-sm {
width: 46%;
}
.col-7-sm {
width: 54.33%;
}
.col-8-sm {
width: 62.66%;
}
.col-9-sm {
width: 71%;
}
.col-10-sm {
width: 79.33%;
}
.col-11-sm {
width: 87.66%;
}
.col-12-sm {
width: 96%;
}
.row::after {
content: "";
display: table;
clear: both;
}
.hidden-sm {
display: none;
}
.pull-right {
float: right;
}
#media only screen and (min-width: 33.75em) {
/* 540px */
.container {
width: 90%;
}
}
#media only screen and (min-width: 45em) {
/* 720px */
.col-1 {
width: 4.33%;
}
.col-2 {
width: 12.66%;
}
.col-3 {
width: 21%;
}
.col-4 {
width: 29.33%;
}
.col-5 {
width: 37.66%;
}
.col-6 {
width: 46%;
}
.col-7 {
width: 54.33%;
}
.col-8 {
width: 62.66%;
}
.col-9 {
width: 71%;
}
.col-10 {
width: 79.33%;
}
.col-11 {
width: 87.66%;
}
.col-12 {
width: 96%;
}
.hidden-sm {
display: block;
}
.hidden-lg {
display: none;
}
.footer-text {
text-align: left !important;
padding: 13px 0;
}
input[type="submit"] {
float: right !important;
width: 200px !important;
}
}
#media only screen and (min-width: 60em) {
/* 960px */
.container {
width: 100%;
max-width: 60rem;
}
}
/* HEADER */
header {
width: 100%;
padding: 10px 0;
border-bottom: 1px solid #d9e3ed;
background: #fff;
}
.sec-images {
text-align: center;
}
.sec-images img {
height: 45px
}
ul {
list-style: none;
float: right;
margin: 0;
}
li {
display: flex;
}
li.phone {
font-size: 21px;
font-weight: bold;
color: #536f86;
height: 35px;
}
li.phone:before {
content: url(http://themedicalsupplydepot.com/email/telephone.jpg);
display: inline-block;
margin-right: 10px;
}
li.hours {
font-size: 12px;
font-weight: bold;
color: #333;
height: 35px;
}
li.hours:before {
content: url(http://themedicalsupplydepot.com/email/clock.jpg);
display: inline-block;
margin-right: 10px;
}
li.email {
font-size: 11px;
font-weight: bold;
height: 29px;
line-height: 2.7;
}
li.email:before {
content: url(http://themedicalsupplydepot.com/email/contact.jpg);
display: inline-block;
margin-right: 10px;
}
/* FOOTER */
footer {
width: 100%;
padding: 1em 0;
border-top: 1px solid #d9e3ed;
background: #fff;
margin-top: 50px;
}
.footer-text {
text-align: center;
padding: 13px 0;
}
.footer-images {
text-align: center;
}
.footer-images img {
height: 45px;
vertical-align: middle;
}
/* FORM */
label {
font-weight: 700;
color: #536f86;
}
input[type="text"],
input[type="email"],
input[type="number"] {
border: 1px solid #d9e3ed;
padding: 0 10px;
height: 40px;
line-height: 36px;
font-size: 16px;
color: #193652;
border-radius: 6px;
width: 95%;
margin-bottom: 10px;
}
select {
border: 1px solid #d9e3ed;
padding: 0 10px;
height: 40px;
line-height: 36px;
font-size: 16px;
color: #193652;
border-radius: 6px;
width: 99%;
margin-bottom: 10px;
background: #fff;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="textarea"]:focus,
select:focus {
border: 1px solid #9d2a31 !important;
box-shadow: none!important;
outline: none!important;
}
input[type="textarea"] {
border: 1px solid #d9e3ed;
padding: 0 10px;
height: 120px;
line-height: 36px;
font-size: 16px;
color: #193652;
border-radius: 6px;
width: 95%;
}
input[type="file"] {
height: 40px;
font-size: 16px;
color: #193652;
width: 95%;
}
input[type="submit"] {
height: 60px;
line-height: 48px;
padding: 0 30px;
font-size: 20px;
text-transform: none;
color: #fff;
border-radius: 6px;
background: #9d2a31;
float: left;
width: 99%
}
<header>
<div class="container">
<div class="row">
<div class="col-6-sm col-3">
<img src="http://themedicalsupplydepot.com/email/logo.jpg">
</div>
<div class="col-6 hidden-sm sec-images">
<img src="https://secure.medicalsupplydepot.com/site/img/verisign_l.gif"><br>
<img src="https://images.scanalert.com/meter/www.medicalsupplydepot.com/13.gif">
</div>
<div class="col-6-sm col-3">
<ul>
<li class="phone">(800) 965-7496</li>
<li class="hours">Monday through Friday,<br>9am to 9pm (Eastern Time)</li>
<li class="email">info#medicalsupplydepot.com</li>
</ul>
</div>
</div>
</div>
</header>
<section>
<div class="container">
<div class="row">
<div class="col-12">
<h2>Please fill in the details:</h2>
</div>
</div>
<div class="row">
<form>
<div class="col-sm-12 col-6">
<!-- Replace <nlsalutation></nlsalutation>-->
<label>Mr/Mrs</label>
<input type="text">
<!-- End Replace -->
<!-- Replace <nlfirstname></nlfirstname>-->
<label>First Name</label>
<input type="text">
<!-- End Replace -->
<!-- Replace <nllastname></nllastname>-->
<label>Last Name</label>
<input type="text">
<!-- End Replace -->
<!-- Replace <nlemail></nlemail>-->
<label>Email</label>
<input type="email">
<!-- End Replace -->
<!-- Replace <nlphone></nlphone>-->
<label>Phone Number</label>
<input type="number">
<!-- End Replace -->
<!-- Replace <nlfile></nlfile>-->
<label>File</label>
<input type="file">
<!-- End Replace -->
<!-- Replace <nlcomments></nlcomments>-->
<label>Comments</label>
<input type="textarea">
<!-- End Replace -->
</div>
<div class="col-sm-12 col-6">
<!-- Replace <nladdress1></nladdress1>-->
<label>Address line 1</label>
<input type="text">
<!-- End Replace -->
<!-- Replace <nladdress2></nladdress2>-->
<label>Address line 2</label>
<input type="text">
<!-- End Replace -->
<!-- Replace <nladdress3></nladdress3>-->
<label>Address line 3</label>
<input type="text">
<!-- End Replace -->
<!-- Replace <nlstate></nlstate>-->
<label>State</label>
<select name="cars">
<option value="option1">Option1</option>
<option value="option2">Option2</option>
<option value="option3">Option3</option>
<option value="option4">Option4</option>
</select>
<!-- End Replace -->
<!-- Replace <nlzipcode></nlzipcode>-->
<label>Zip/Postal Code</label>
<input type="text">
<!-- End Replace -->
</div>
</form>
</div>
<div class="row">
<div class="col-12">
<input type="submit">
</div>
</div>
</div>
</section>
<footer>
<div class="container">
<div class="row">
<div class="col-12-sm footer-text">
© 2017 Medical Supply Depot.
</div>
<div class="col-12-sm hidden-lg footer-images">
<img src="https://secure.medicalsupplydepot.com/site/img/verisign_l.gif">
<img src="https://images.scanalert.com/meter/www.medicalsupplydepot.com/13.gif" style="margin-top:5px;">
</div>
</div>
</div>
</footer>

div table cell width totally ignored

As per title, cell width is totally ignored - tried so many things and none work. Tried inspecting to see if there is any inheritance that i do not know about but nothing showed up. The cells just split into equal chunks and cell width property is ignored.
.CalculateBtn {
background-color: #96c11f;
width: 200px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: Raleway, Arial;
font-size: 21px;
font-weight: normal;
padding: 10px 10px;
text-decoration: none;
text-align: center;
}
.CalculateBtn:hover {
background-color: #7f0050;
color: #ffffff;
}
.divTable {
display: table;
width: 100%;
table-layout: fixed;
/*vertical-align: top;*/
}
.divTableRow {
display: table-row;
background-color: #0d56c2;
}
.divTableButtonRow {
display: table-row;
}
.divTableHead-left {
background-color: #7F0050;
display: table-cell;
padding: 3px 10px;
width: 30%;
}
.divTableHead-center {
color: #ffffff;
text-align: center;
font-family: raleway, arial, helvetica, sans-serif;
background-color: #7F0050;
display: table-cell;
padding: 3px 10px;
width: 40%;
}
.divTableHead-right {
background-color: #7F0050;
display: table-cell;
padding: 3px 10px;
width: 30%;
}
/* Table Cells */
.divTableCell-left,
.divTableHead {
border-right: 1px solid #ffffff;
border-top: 1px solid #ffffff;
display: table-cell;
padding: 3px 10px;
width: 20%;
}
.divTableCell-center,
.divTableHead {
border-right: 1px solid #ffffff;
border-top: 1px solid #ffffff;
display: table-cell;
padding: 3px 10px;
width: 30%;
color: #ffffff;
}
.divTableCell-right,
.divTableHead {
border-right: 1px solid #ffffff;
border-top: 1px solid #ffffff;
display: table-cell;
padding: 3px 10px;
width: 50%;
color: #ffffff;
}
/* Button Cell properties */
.divTableCellButton-left,
.divTableHead {
display: table-cell;
padding: 3px 10px;
width: 30%;
}
.divTableCellButton-center,
.divTableHead {
display: table-cell;
padding: 3px 10px;
width: 40%;
}
.divTableCellButton-right,
.divTableHead {
display: table-cell;
padding: 3px 10px;
width: 30%;
}
/* End Button Cell properties */
/* INFO cell properties*/
.divTableCellInfo-left {
color: #ffffff;
display: table-cell;
padding: 3px 10px;
max-width: 20%;
}
.divTableCellInfo-right {
color: #ffffff;
display: table-cell;
padding: 3px 10px;
max-width: 80%;
}
/* End info cell properties*/
.divTableFoot {
background-color: #EEE;
display: table-footer-group;
font-weight: bold;
}
.divTableBody {
display: table-row-group;
}
<div class="divTable" style="border: 1px solid #ffffff;">
<div class="divTableBody">
<div class="divTableHead-left"> </div>
<div class="divTableHead-center">
<font size="4">Staffing Calculator K=2</font>
</div>
<div class="divTableHead-right"> </div>
<div class="divTableRow">
<div class="divTableCell-left">
<font color="#ffffff">Calls:</font>
</div>
<div class="divTableCell-center"><input type="text" name="calls" id="calls" style="width: 80px;" value="151"></div>
<div class="divTableCell-right">
<font color="#ffffff">in a period of</font>
<input name="period" value="5" />
<select name="callUnit">
<option value="hour" selected>hours</option>
<option value="minute" >minutes</option>
</select>
</div>
</div>
<div class="divTableRow">
<div class="divTableCell-left">
<font color="#ffffff">Average Handle Time: </font>
</div>
<div class="divTableCell-center"><input type="text" name="aht" value="300"></div>
<div class="divTableCell-right">
<select name="ahtUnit">
<option value="minute" >minutes</option>
<option value="second" selected>seconds</option>
</select> <i>include time spent on phone and time working after call. Usually between 3 and 5 minutes.</i>
</div>
</div>
</div>
I use colgroup for this. I see you are using div's in your markup and table related CSS to style your table, so my suggestion would require that you change your markup to table markup (not sure if doable).
table {
width: 100%;
table-layout: fixed;
}
th {
background: #0095ff;
color: white;
}
td {
border: 1px solid #ccc;
}
<table>
<colgroup>
<col style="width:30%" />
<col style="width:40%" />
<col style="width:30%" />
</colgroup>
<thead>
<tr>
<th colspan="3">This is the table header</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
</tr>
</tbody>
</table>

How to align text in navigation header, using CSS and HTML?

I am beginner to web development. In fact, this is my second html page so its not very neat and tidy.
I have added three navigation links in the navigation header but all of them are lying outside the line and no matter what I can't fix them.
Can anyone help please? You can ignore the other code and check only navigation one.
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<title>The cutest creatures</title>
<style>
body {
margin-left: 80px;
background-image: url("img/wallpaper2.jpg");
background-size: cover;
}
p {
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: black;
}
#unique {
overflow: auto;
}
#image {
float: left;
margin-right: 20px;
}
#tab {
background-image: url("img/wallpaper31.jpg");
height: 120px;
padding-top: 50px;
background-color: black;
margin-top: 25px;
}
#content {
background-color: rgba(255, 231, 0, 0.5);
padding: 1px 25px;
margin: 1px 1px 25px 1px;
}
ul {
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: black;
}
ol {
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: black;
}
div {
padding: 20px;
margin-bottom: 30px;
}
.a {
border: 2px teal dashed;
float: left;
margin-left: 6px;
}
.b {
border: 2px teal dashed;
float: right;
margin-right: 80px;
}
table {
margin: 80px;
padding: 15px;
border: 3px solid black;
width: 100%;
border-collapse: collapse;
margin-left: 1px;
}
caption {
font-size: 20px;
text-align: left;
padding: 10px;
margin: 10px;
}
th, td {
height: 8px;
padding: 8px;
border: 3px solid black;
}
th {
background-color: #ececec;
}
nav {
overflow: hidden;
margin: 0px;
padding: 0px;
}
li a {
display: block;
color: #ffff00;
text-decoration: none;
float: right;
padding: 0px 20px;
margin: 0px;
position: relative;
}
#header {
padding: 0px 0px;
border-bottom: 1px solid black;
margin: auto;
height: 100px;
line-height: 103px;
margin-top: 1px;
}
</style>
</head>
<body>
<div id="header">
<img src="img/logo.jpg" width="100" height="100">
<nav>
<ul style="list-style-type:none;">
<li>Famous quotes</li>
<li>Some Famous Minions</li>
<li>Notable Minions</li>
</ul>
</nav>
</div>
<div id="tab">
<div id="content">
<center>
<h1>Minions</h1>
<h2><b><i>Bello!!!</i></b></h2>
</center>
</div>
</div>
<div id="unique">
<img src="img/mmm.jpg" id="image">
<p>The <b> Minions </b> are small, yellow, cylindrical creatures <del>who have one or two eyes</del>.
<br>They bring much of the comedy in the film, and they are known as the <mark>scene-stealer</mark> of the movie.
<br>Frequently, they speak in an incomprehensible language, called <u>Minionese</u>, occasionally switching to English.
<br>They are much childish in some ways, yet they seem to be very intelligent in certain aspects.Click here to know more about minions.</p>
</div>
<div class="a">
<h3>Famous quotes</h3>
<ul>
<li>"BEE-DO! BEE-DO!" - Carl mimicking fire truck siren.</li>
<li>"POOPAYE" - Goodbye</li>
<li>"TULALILOO TI AMO!" - We love you!</li>
</ul>
</div>
<div class="b">
<h3>Some Famous Minions</h3>
<ol>
<li>Bob</li>
<li>Kevin</li>
<li>Stuart</li>
</ol>
</div>
<table>
<caption><b>Notable Minions</b></caption>
<tbody>
<tr>
<th>NAME</th>
<th>APPEARANCE</th>
</tr>
<tr>
<td>Carl</td>
<td>Despicable Me</td>
</tr>
<tr>
<td>Dave</td>
<td>Despicable Me</td>
</tr>
<tr>
<td>Bob</td>
<td>Despicable Me 2</td>
</tr>
<tr>
<td>Stuart</td>
<td>Despicable Me 2</td>
</tr>
<tr>
<td>Kevin</td>
<td>Orientation Day</td>
</tr>
</tbody>
</table>
</body>
</html>
I believe this is better :
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<title>The cutest creatures</title>
<style>
body {
margin-left: 80px;
background-image: url("img/wallpaper2.jpg");
background-size: cover;
}
p {
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: black;
}
#unique {
overflow: auto;
}
#image {
float: left;
margin-right: 20px;
}
#tab {
background-image: url("img/wallpaper31.jpg");
height: 130px;
padding-bottom: 50px;
background-color: black;
margin-top: 15px;
}
#content {
background-color: rgba(255, 231, 0, 0.5);
padding: 1px 25px;
margin: 1px;
}
ul {
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: black;
}
ol {
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: black;
}
div {
padding: 20px;
margin-bottom: 30px;
}
.a {
border: 2px teal dashed;
float: left;
margin-left: 6px;
}
.b {
border: 2px teal dashed;
float: right;
margin-right: 80px;
}
table {
margin: 80px;
padding: 15px;
border: 3px solid black;
width: 100%;
border-collapse: collapse;
margin-left: 1px;
}
caption {
font-size: 20px;
text-align: left;
padding: 10px;
margin: 10px;
}
th, td {
height: 8px;
padding: 8px;
border: 3px solid black;
}
th {
background-color: #ececec;
}
nav {
overflow: hidden;
margin: 0px;
padding: 0px;
text-align: center;
width:100%;
}
li, li a {
display: inline;
color: #ffff00;
text-decoration: none;
padding: 0px 10px;
}
#header {
padding: 0px 0px;
border-bottom: 1px solid black;
margin: auto;
height: 100px;
line-height: 103px;
margin-top: 1px;
}
</style>
</head>
<body>
<div id="header">
<img src="img/logo.jpg" width="100" height="100">
</div>
<div id="tab">
<div align="center" id="content">
<h1>Minions</h1>
<h2><b><i>Bello!!!</i></b></h2>
</div>
<nav>
<ul style="list-style-type:none;">
<li>Famous quotes</li>
<li>Some Famous Minions</li>
<li>Notable Minions</li>
</ul>
</nav>
</div>
<div id="unique">
<img src="img/mmm.jpg" id="image">
<p>The <b> Minions </b> are small, yellow, cylindrical creatures <del>who have one or two eyes</del>.
<br>They bring much of the comedy in the film, and they are known as the <mark>scene-stealer</mark> of the movie.
<br>Frequently, they speak in an incomprehensible language, called <u>Minionese</u>, occasionally switching to English.
<br>They are much childish in some ways, yet they seem to be very intelligent in certain aspects.Click here to know more about minions.</p>
</div>
<div class="a">
<h3>Famous quotes</h3>
<ul>
<li>"BEE-DO! BEE-DO!" - Carl mimicking fire truck siren.</li>
<li>"POOPAYE" - Goodbye</li>
<li>"TULALILOO TI AMO!" - We love you!</li>
</ul>
</div>
<div class="b">
<h3>Some Famous Minions</h3>
<ol>
<li>Bob</li>
<li>Kevin</li>
<li>Stuart</li>
</ol>
</div>
<table>
<caption><b>Notable Minions</b></caption>
<tbody>
<tr>
<th>NAME</th>
<th>APPEARANCE</th>
</tr>
<tr>
<td>Carl</td>
<td>Despicable Me</td>
</tr>
<tr>
<td>Dave</td>
<td>Despicable Me</td>
</tr>
<tr>
<td>Bob</td>
<td>Despicable Me 2</td>
</tr>
<tr>
<td>Stuart</td>
<td>Despicable Me 2</td>
</tr>
<tr>
<td>Kevin</td>
<td>Orientation Day</td>
</tr>
</tbody>
</table>
</body>
</html>
These two setting should help you to get started:
nav {
float: right;
}
nav li {
display: inline-block;
}
The first one allows you to place the whole nav right of the image, the second one causes the li elements to be aligned horizontally instead of vertically (as they would be with their default display: block setting).
(Switch the snippet to full page view to see the proper result)
body {
margin-left: 80px;
background-image: url("img/wallpaper2.jpg");
background-size: cover;
}
p {
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: black;
}
#unique {
overflow: auto;
}
#image {
float: left;
margin-right: 20px;
}
#tab {
background-image: url("img/wallpaper31.jpg");
height: 120px;
padding-top: 50px;
background-color: black;
margin-top: 25px;
}
#content {
background-color: rgba(255, 231, 0, 0.5);
padding: 1px 25px;
margin: 1px 1px 25px 1px;
}
ul {
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: black;
}
ol {
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: black;
}
div {
padding: 20px;
margin-bottom: 30px;
}
.a {
border: 2px teal dashed;
float: left;
margin-left: 6px;
}
.b {
border: 2px teal dashed;
float: right;
margin-right: 80px;
}
table {
margin: 80px;
padding: 15px;
border: 3px solid black;
width: 100%;
border-collapse: collapse;
margin-left: 1px;
}
caption {
font-size: 20px;
text-align: left;
padding: 10px;
margin: 10px;
}
th,
td {
height: 8px;
padding: 8px;
border: 3px solid black;
}
th {
background-color: #ececec;
}
nav {
overflow: hidden;
margin: 0px;
padding: 0px;
}
li a {
display: block;
color: #ffff00;
text-decoration: none;
float: right;
padding: 0px 20px;
margin: 0px;
position: relative;
}
#header {
padding: 0px 0px;
border-bottom: 1px solid black;
margin: auto;
height: 100px;
line-height: 103px;
margin-top: 1px;
}
nav {
float: right;
}
nav li {
display: inline-block;
}
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<title>The cutest creatures</title>
</head>
<body>
<div id="header">
<img src="img/logo.jpg" width="100" height="100">
<nav>
<ul style="list-style-type:none;">
<li>Famous quotes</li>
<li>Some Famous Minions</li>
<li>Notable Minions</li>
</ul>
</nav>
</div>
<div id="tab">
<div id="content">
<center>
<h1>Minions</h1>
<h2><b><i>Bello!!!</i></b></h2>
</center>
</div>
</div>
<div id="unique">
<img src="img/mmm.jpg" id="image">
<p>The <b> Minions </b> are small, yellow, cylindrical creatures <del>who have one or two eyes</del>.
<br>They bring much of the comedy in the film, and they are known as the <mark>scene-stealer</mark> of the movie.
<br>Frequently, they speak in an incomprehensible language, called <u>Minionese</u>, occasionally switching to English.
<br>They are much childish in some ways, yet they seem to be very intelligent in certain aspects.Click here to know more about minions.</p>
</div>
<div class="a">
<h3>Famous quotes</h3>
<ul>
<li>"BEE-DO! BEE-DO!" - Carl mimicking fire truck siren.</li>
<li>"POOPAYE" - Goodbye</li>
<li>"TULALILOO TI AMO!" - We love you!</li>
</ul>
</div>
<div class="b">
<h3>Some Famous Minions</h3>
<ol>
<li>Bob</li>
<li>Kevin</li>
<li>Stuart</li>
</ol>
</div>
<table>
<caption><b>Notable Minions</b></caption>
<tbody>
<tr>
<th>NAME</th>
<th>APPEARANCE</th>
</tr>
<tr>
<td>Carl</td>
<td>Despicable Me</td>
</tr>
<tr>
<td>Dave</td>
<td>Despicable Me</td>
</tr>
<tr>
<td>Bob</td>
<td>Despicable Me 2</td>
</tr>
<tr>
<td>Stuart</td>
<td>Despicable Me 2</td>
</tr>
<tr>
<td>Kevin</td>
<td>Orientation Day</td>
</tr>
</tbody>
</table>
</body>
</html>

Make responsive container

I am making a website and I want, on different displays, for it to look almost the same, if I zoom the margin to be smaller - I think you know what I am trying to say. I am looking at another site to see how it works. You can check it here: http://motika.com.mk/. Try to zoom there. I don't know what the problem is.
This is my code:
<head>
<link rel="stylesheet" href="dodatoci/stilovi/stilovi.css">
<meta charset="utf-8"/>
<title>Услуги | Што се нуди?</title>
</head>
<body>
<div id = "glavendrzac">
<!--<table id = "goretabela">
<tr>
<td style="width:220px;"><img src="dodatoci/sliki/logo.png" id = "logoslika" onmouseover="this.src='dodatoci/sliki/logohover.png';" onmouseout="this.src='dodatoci/sliki/logo.png';"/></td>
<div class="dropdown">
<td style="width:220px;"><button class = "dropbtn"></button></td>
</div>
</div>
</tr>
</table>-->
<div id = "meni">
<nav>
<ul id = "meninav">
<li><img src="dodatoci/sliki/logo.png" onmouseover="this.src='dodatoci/sliki/logohover.png';" onmouseout="this.src='dodatoci/sliki/logo.png';"/></li>
<li><div class="dropdown" style="float:left;">
<button class="dropbtn"></button>
<div class="dropdown-content" style="left:0;">
<table id = "tabelamenispusti">
<tr>
<td>
Берово
Битола
Богданци
Валандово
Велес
Виница
Гевгелија
Гостивар
Дебар
</td>
<td>
Делчево
Демир Капија
Демир Хисар
Кавадарци
Кичево
Кочани
Кратово
Крива Паланка
Куманово
</td>
<td>
Крушево
М. Брод
M. Каменица
Неготино
Охрид
Пехчево
Прилеп
Пробиштип
Радовиш
</td>
<td>
Ресен
Свети Николе
<strong>Скопје</strong>
Струга
Струмица
Тетово
Штип
</td>
</tr>
</table>
</div>
</div></li>
</ul>
</nav>
</div>
<div id = "uslugibn">
<img style="width:100%; height: 300px;" src="dodatoci/sliki/banner.png"/>
</div>
<div id = "reklama">
<img src="dodatoci/reklami/setec1.jpg" style = "width:100%;"/>
</div>
</div>
</body>
And this is CSS code:
body{
background-color: #e4e4e4;
margin: 0;
}
#glavendrzac{
margin-left: 10%;
margin-right: 10%;
margin-top: 1em;
background-size: contain;
}
.logoslika:hover{
cursor:text;
}
#goretabela{
border-collapse: collapse;
background-color: #41c2ac;
width: 100%;
}
#goretabela td{
border-collapse: collapse;
overflow: hidden;
display: inline-block;
white-space: nowrap;
}
#goretabela td tr{
border-collapse: collapse;
}
.dropbtn {
background-image: url("../sliki/meni.jpg");
width: 220px;
height: 60px;
border: none;
cursor: pointer;
display: inline;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
padding: 0;
margin: 0;
}
.dropdown-content a {
color: black;
padding: 10px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #51d2bc}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-image: url("../sliki/menihover.jpg");
}
#uslugibn{
background-image: url("../sliki/banner.png");
width: 100%;
height: 300px;
}
#meninav{
background-color: #41c2ac;
height: 60px;
margin: 0;
}
#meninav li{
display: inline-block;
}
#tabelamenispusti{
border: 2px solid #41c2ac;
padding: 0;
margin: 0;
}
#tabelamenispusti a{
width: 150px;
}
#tabelamenispusti td{
padding: 0;
margin: 0;
}
Can you add this code
#main {
max-width: 1278px;
width: 90%;
}

Making a dynamic sizing table lock it's size when window enlarged

I have a dynamically resizing table for small browser windows. It resizes great! It looks great under 810px, but the problem is that I want it to lock the size of the table once its over 800px. Right now when I get over 810px, I lose the Arial font and the border-collapse. I don't know why this isn't working!
Please take a look and see if a new set of eyes can spot what's going on.
#formatscreen {
font-family: Arial;
width: 800px;
border-collapse: collapse;
}
th {
background: black;
color: white;
font-size: 20px;
}
th,
td {
border: 1px solid #000;
border-bottom: 2px solid #fff;
// padding-left: 5px;
// padding-right: 5px;
}
#screen_symbol {
font-size: 40px;
font-weight: bold;
text-align: center;
display: inline-block
}
#screen_price {
font-size: 32px;
font-weight: bold;
display: inline-block
}
#screen_net_pct {
font-size: 24px;
font-weight: bold;
display: inline-block
}
#screen_expiry.header,
#screen_type.header,
#screen_dist.header,
#screen_short_leg.header,
#screen_long_leg.header {
font-size: 20px;
display: inline-block
}
#screen_change.header,
#screen_delta.header,
#screen_short_leg_vol.header,
#screen_long_leg_vol.header,
#screen_net.header {
font-size: 14px;
display: inline-block
}
#screen_expiry,
#screen_type,
#screen_dist,
#screen_short_leg,
#screen_long_leg {
font-size: 24px;
display: inline-block
}
#screen_change,
#screen_delta,
#screen_short_leg_vol,
#screen_long_leg_vol,
#screen_net {
font-size: 16px;
display: inline-block
}
#media only screen and (max-device-width: 480px),
(max-width: 810px) {
#formatscreen {
font-family: Arial;
width: 100%;
border-collapse: collapse;
}
th {
background: black;
color: white;
font-size: 2.5vw;
}
th,
td {
border: 1px solid #000;
border-bottom: 2px solid #fff;
// padding-left: 5px;
// padding-right: 5px;
}
#screen_symbol {
font-size: 5vw;
font-weight: bold;
text-align: center;
display: inline-block
}
#screen_price {
font-size: 4vw;
font-weight: bold;
display: inline-block
}
#screen_net_pct {
font-size: 3vw;
font-weight: bold;
display: inline-block
}
#screen_expiry.header,
#screen_type.header,
#screen_dist.header,
#screen_short_leg.header,
#screen_long_leg.header {
font-size: 2.5vw;
display: inline-block
}
#screen_change.header,
#screen_delta.header,
#screen_short_leg_vol.header,
#screen_long_leg_vol.header,
#screen_net.header {
font-size: 1.75vw;
display: inline-block
}
#screen_expiry,
#screen_type,
#screen_dist,
#screen_short_leg,
#screen_long_leg {
font-size: 3vw;
display: inline-block
}
#screen_change,
#screen_delta,
#screen_short_leg_vol,
#screen_long_leg_vol,
#screen_net {
font-size: 2vw;
display: inline-block
}
}
#screen_change.up {
background: green;
color: white;
}
#screen_change.down {
background: red;
color: white;
}
.center {
text-align: center;
}
.right {
text-align: right;
}
tr[data-bau="Bull Put"] {
background: #99ff99;
}
tr[data-bau="Bear Call"] {
background: #ff9999;
}
tr:hover[data-bau="Bull Put"] {
background-color: #00b300;
cursor: pointer;
}
tr:hover[data-bau="Bear Call"] {
background-color: #ff0000;
cursor: pointer;
}
<div id="prescreen">
<table id="formatscreen">
<tr>
<th>
Symbol</th>
<th>Price Action</th>
<th>Expiry Date
<br>Type</th>
<th class="right">
<div id="screen_dist" class="header">Distance</div>
<div id="screen_delta" class="header">Delta</div>
</th>
<th class="right">
<div id="screen_short_leg" class="header">Short Leg</div>
<div id="screen_short_leg_vol" class="header">Volume</div>
</th>
<th class="right">
<div id="screen_long_leg" class="header">Long Leg</div>
<div id="screen_long_leg_vol" class="header">Volume</div>
</th>
<th>Return</th>
</tr>
<tr data-bau="Bull Put">
<td>
<div id="screen_symbol">IBB</div>
</td>
<td class="center">
<div id="screen_price">$1260.39</div>
<div id="screen_change" class="down">-$12.36 (0.91%)</div>
</td>
<td class="center">
<div id="screen_expiry">20160819</div>
<div id="screen_type">Bull Put</div>
</td>
<td class="right">
<div id="screen_dist">15.5%</div>
<div id="screen_delta">0.077</div>
</td>
<td class="right">
<div id="screen_short_leg">$1220.00</div>
<div id="screen_short_leg_vol">1420</div>
</td>
<td class="right">
<div id="screen_long_leg">$1915.00</div>
<div id="screen_short_leg_vol">20</div>
</td>
<td class="right">
<div id="screen_net_pct">3.00%</div>
<div id="screen_net">$0.25</div>
</td>
</tr>
<tr data-bau="Bear Call">
<td>
<div id="screen_symbol">NFLX</div>
</td>
<td class="center">
<div id="screen_price">$1260.39</div>
<div id="screen_change" class="up">+$12.36 (0.91%)</div>
</td>
<td class="center">
<div id="screen_expiry">20160819</div>
<div id="screen_type">Bull Put</div>
</td>
<td class="right">
<div id="screen_dist">15.5%</div>
<div id="screen_delta">0.077</div>
</td>
<td class="right">
<div id="screen_short_leg">$1220.00</div>
<div id="screen_short_leg_vol">20</div>
</td>
<td class="right">
<div id="screen_long_leg">$1915.00</div>
<div id="screen_short_leg_vol">20</div>
</td>
<td class="right">
<div id="screen_net_pct">3.00%</div>
<div id="screen_net">$0.25</div>
</td>
</tr>
</table>
words words
</div>
You are using vw for font sizes. Size of vw changes according to the device width.
Check this: https://jsfiddle.net/LtLmr5s5/1/
All you need here is one simple CSS property: max-width
#formatscreen {
max-width: 800px;
width: 100%;
/* ... */
}
Your code works fine if you remove the in CSS not allowed // comments:
//# width:800px
//2.5vw = 20px
//1.75vw = 14px
//1vw = 8px
They can be used in SCSS only.
So this is enough:
#formatscreen {
font-family: Arial;
width: 800px;
border-collapse: collapse;
}
/* ... */
#media only screen and (max-device-width: 480px),
(max-width:810px) {
#formatscreen {
width: 100%;
}
/* ... */
}
/* ... */
Furthermore there is no need to set a media query for this as you can see in TheThirdMans answer.