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

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.

Related

How to center a navbar under a heading?

I have a problem laying out and centering the navbar and the table. I want the navbar to be right under the h2 element and centered. At the moment, the navbar breaks onto the next line. The layout of the table is fine, but it should be centered. I wonder if there is a better technique for making a navbar.
Here is my code:
* {
background-color: #2c2f33;
text-decoration: none;
}
.bet-table {
display: table-cell;
margin: 0;
color: white;
}
.bet-table th,
td {
border: 1px solid;
text-align: center;
padding: 5px 5px 5px;
}
.bet-table table {
margin-left: auto;
margin-right: auto;
}
.logo {
text-align: center;
font-size: 40px;
font-family: arial;
font-weight: lighter;
color: white;
}
.nav-g ul {
list-style: none;
padding: 0;
margin: 0;
}
.nav-g li {
list-style: none;
display: inline-block;
}
.nav-g a {
text-decoration: none;
width: 100px;
display: block;
padding: 2px 2px 2px;
font-size: 15px;
font-weight: lighter;
text-align: center;
color: white;
font-family: arial;
float: left;
}
.Choose h3 {
color: white;
background-color: #7289da;
padding: 8px 8px 8px 8px;
border: 1px solid black;
font-family: Arial, Helvetica, sans-serif;
font-weight: lighter;
margin-top: 5pc;
}
.navbar a:hover {
color: #7289da;
}
<div id="h-container">
<h2 class="logo">Betbowl
<h2>
<div class="nav-g">
<ul>
<li><a href="#">Make-A-Bet</li>
<li><a href="#">Pending</li>
<li><a href="#">Completed</li>
</ul>
</div>
</div>
<div class="Choose">
<h3>Choose</h3>
</div>
<div class="bet-table">
<table style="width:100%; margin-left: auto; margin-right: auto;">
<tr>
<th>Situation</th>
<th>Bet</th>
<th>Winner</th>
<th>Earnings</th>
</tr>
<tr>
<td>blank</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
</tr>
<tr>
<td>blank</td>
<td>blank</td>
<td>blank</td>
<td>blank</td>
</tr>
<tr>
</tr>
</table>
</div>
</div>
First you need to close your <a> tags. like this:
I AM A LINK
ul needs to be centered:
text-align:center
for the table you should remove display property from the container, default value works fine:
.bet-table{
/* display: table-cell; REMOVE THIS LINE */
margin: 0;
color: white;
text-align: center;
width: 100%;
}
table{
margin: 0 auto
}
find the edited version here: https://codepen.io/theBehrouz/pen/QWmXZbr

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>

Image responsiveness breaks in 320x568

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>

how to show two different font size ,2 different texts using html,css

1st text part has two lines. 2nd text line has only one line. Here, I attached the image:
How do I do this using css?
<td class="right-col">
<div>
<div>
<span>average<br>cost</span>
</div>
<div>
<span>$2,500</span>
</div>
</div>
</td>
Try to this way
define class on your div and some write css according to your design.
.mainDiv{
padding: 20px;
background: #fcfcfc;}
.left-text {
display: inline-block;
vertical-align: top;
text-align: right;
color: gray;
text-transform: uppercase;
font-size: 11px;
line-height: 13px;
}
.right-text {
display: inline-block;
vertical-align: top;
text-align: right;
color: gray;
text-transform: uppercase;
font-size: 23px;
margin-left: 5px;
}
<div class="mainDiv">
<div class="left-text">
<span>average<br>cost</span>
</div>
<div class="right-text">
<span>$2,500</span>
</div>
</div>
One of the many ways you can do this.
.container {
width: 200px;
background: #E0E0E0;
font-size: 0;
font-family: sans-serif, serif;
padding: 20px;
}
.column {
color: #757575;
font-size: 16px;
display: inline-block;
width: 50%;
padding: 10px;
box-sizing: border-box;
vertical-align: middle;
}
.txt-left {
text-align: left;
font-size: 24px;
}
.txt-right {
font-size: 12px;
text-align: right;
}
<div class="container">
<div class="column txt-right">
<span>AVERAGE<br>COST</span>
</div>
<div class=" column txt-left">
<span>$2,500</span>
</div>
</div>
.right-col div {
table-layout: fixed;
font-family: Arial, sans-serif;
text-transform: uppercase;
background: linear-gradient(to bottom, #f7f8f8 0%,#fbfbfb 56%,#f5f6f6 74%,#e8e9e9 100%);
line-height: 10px;
font-size: 10px;
color: #85929c;
display: table;
width: 200px;
}
.right-col div span {
vertical-align: top;
display: table-cell;
padding: 10px 3px;
}
.right-col .text {
text-align: right;
}
.right-col .amount {
line-height: 20px;
font-size: 18px;
}
<table class="table">
<tbody>
<tr>
<td class="right-col">
<div>
<span class="text">average<br>cost</span>
<span class="amount">$2,500</span>
</div>
</td>
</tr>
</tbody>
</table>

HTML/CSS Table height ignored in Internet Explorer

I'm adding a new 'News Container' to a slightly older webpage at our firm.
This container is made up of a 2x3 table. I want the Cell 2x2 to be as High as the Text.
Here's the Problem:
Everybody uses IE in our offices (Security reasons etc.) but for some reason IE ignores the height attribute given either directly in HTML (style="height:;" or height="") or in a separate CSS.
So in Chrome it looks like this (how it should):
╔════════════════╗
╠══╦═════════════╣
║  ║Test String  ║
║  ╠═════════════╣
╚══╩═════════════╝
And in Internet Explorer like this:
╔════════════════╗
╠══╦═════════════╣
║  ║Test String  ║
║  ║ ║
║  ╠═════════════╣
╚══╩═════════════╝
Picture: http://imgur.com/a/jQXhQ
View it yourself (Open in both Chrome and IE) here.
How can I get IE to use the Height attribute or alternatively is there a different way?
IE Version: 11.0.9600.17358
Update: 11.0.13
Code:
<table id="NewsTable">
<tr>
<th id="NewsHeader" colspan="2">IT Status</th>
</tr>
<tr>
<td rowspan="2">
<img id="NewsAmpel" alt="NewsStatus" src="Ampel/AmpelA.jpg" width="36px" height="100px">
</td>
<td id="NewsStatus"><b>Status:    </b>Test String</td>
</tr>
<tr>
<td id="NewsDesc"><b>Description: </b>Sample Text</td>
</tr>
i have made some changes in html as well as CSS
Working Fiddle
http://jsfiddle.net/UzCRc/60/
HTML
<table id="NewsTable">
<tr>
<th id="NewsHeader" colspan="2">IT Status</th>
</tr>
<tr>
<td id="NewsAmpel">
<img alt="NewsStatus" src="Ampel/AmpelA.jpg" width="36px" height="100px">
</td>
<td id="NewsStatus"><b>Status:    </b>Test String</td>
<td id="NewsDesc"><b>Description: </b>Sample Text</td>
</tr>
</table>
CSS
#NewsAmpel{
width:36px;
}
body {
font-family: Verdana, sans-serif;
font-size: 13px;
}
h1 {
font-size: 15px;
font-weight: bold;
}
h2 {
font-size: 14px;
body {
font-family: Verdana, sans-serif;
font-size: 13px;
}
h1 {
font-size: 15px;
font-weight: bold;
}
h2 {
font-size: 14px;
font-weight: bold;
}
img {
border: 0;
}
a {
color: #00538E;
}
#content {
width: 100%;
float: left;
}
#center {
width: 600px;
height: auto;
margin: 0 auto;
}
font-weight: bold;
}
img {
border: 0;
}
a {
color: #00538E;
}
#content {
width: 100%;
float: left;
}
#center {
width: 600px;
height: auto;
margin: 0 auto;
}
#NewsTable {
border: 2px solid #000000;
background-color: #FFFFFF;
width: 100%;
}
#NewsStatus {
height: 20px;
padding:0;
border-bottom: 1px solid #000000;
width: 100%;
vertical-align: top;
display:block;
}
#NewsDesc {
height: 20px;
width: 100%;
margin:0;
padding:0;
display:block;
}
#NewsHeader {
text-align: center;
font-size: 14px;
font-weight: bold;
border: 1px solid #000000;
background-color: #FF1000;
}
Changes in html
Removed colspan
added image TD in same TR
Instead of image, ID has given to TD
CSS changes
#NewsStatus {
height: 20px;
padding:0;
border-bottom: 1px solid #000000;
width: 100%;//modified
vertical-align: top;
display:block;//added
}
#NewsDesc {
height: 20px; //added
width: 100%;//modified
margin:0;
padding:0;
display:block;//added
}
#NewsAmpel{
width:36px;
}