I'm currently busy with building a website and creating a responsive design. But now I have several tables in this design added the css display:block; to them. But now in my responsive design it is aligned to the left. But I want it to be aligned in the center. But when I add text-align:center; or margin:auto; it doesn't work. What can I try more?
Code:
HTML:
<table class="kalender">
<tr>
<td colspan="3">
<h1>Mei</h1>
</td>
</tr>
<tr>
<td>
<img src="Kalender/RundUmDenFinanzplatz.png" id="logos" height="150px" alt="Rund um den Finanzplatz" title="Rund um den Finanzplatz">
<h2>
Rund um den Finanzplatz Eschborn-Frankfurt
</h2>
<h4>
1 Mei 2017
</h4>
<div id="flagid"><img src="Flags/germany.png" id="flag" height="15px" alt="Duitsland" title="Duitsland">
<p>GER</p>
</div>
</td>
<td>
<img src="Kalender/GiroDItalia.png" id="logos" height="150px" alt="Giro d'Italia" title="Giro d'Italia">
<h2>
Giro d'Italia
</h2>
<h4>
5-28 Mei 2017
</h4>
<div id="flagid"><img src="Flags/italy.svg" id="flag" height="15px" alt="Italië" title="Italië">
<p>ITA</p>
</div>
</td>
<td>
<img src="Kalender/TourOfCalifornia.png" id="logos" height="150px" alt="Tour of California" title="Tour of California">
<h2>
Amgen Tour of California
</h2>
<h4>
14-20 Mei 2017
</h4>
<div id="flagid"><img src="Flags/usa.png" id="flag" height="15px" alt="USA" title="USA">
<p>USA</p>
</div>
</td>
</tr>
</table>
CSS:
.kalender {
margin: auto;
margin-top: 50px;
border-top: 2px solid white;
}
.kalender h1 {
color: #ffffff;
font-family: Century Gothic;
font-size: 50pt;
text-align: center;
}
#logos {
display: block;
margin: auto;
opacity: 0.7;
filter: alpha(opacity=70);
}
#logos:hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.kalender h2 {
color: #ffffff;
font-family: century Gothic;
font-weight: bold;
margin-top: 20px;
width: 250px;
text-align: center;
}
.kalender h4 {
color: #ffffff;
font-family: century Gothic;
text-align: center;
margin-top: 10px;
}
.kalender p {
color: #ffffff;
font-family: Century Gothic;
font-size: 12pt;
display: inline;
}
#flagid {
text-align: center;
margin-top: 10px;
}
#flagid img {
margin-right: 5px;
}
#media screen and (max-width: 720px) {
table, td, tr {
display: block;
}
.kalender td, .kalender tr {
margin-top: 0px;
margin-bottom: 50px;
margin-right: 0px;
text-align: center;
margin: auto;
}
.kalender h1 {
font-size: 30pt;
margin: 0px;
text-align: center;
width: 100%;
}
.kalender img {
margin: auto;
text-align: center;
}
.kalender {
margin: auto;
text-align: center;
}
}
You should use "text-align:center;" in style (I don't know what is the rest of your code) or in (width:100%) that include your table.
It's better to do a grid with css for responsive layout , here a solution for your code
.kalender {
margin: auto;
margin-top: 50px;
border-top: 2px solid white;
}
.kalender h1 {
color: #ffffff;
font-family: Century Gothic;
font-size: 50pt;
text-align: center;
}
#logos {
display: block;
margin: auto;
opacity: 0.7;
filter: alpha(opacity=70);
}
#logos:hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
.kalender h2 {
color: #ffffff;
font-family: century Gothic;
font-weight: bold;
margin-top: 20px;
width: 250px;
text-align: center;
}
.kalender h4 {
color: #ffffff;
font-family: century Gothic;
text-align: center;
margin-top: 10px;
}
.kalender p {
color: #ffffff;
font-family: Century Gothic;
font-size: 12pt;
display: inline;
}
#flagid {
text-align: center;
margin-top: 10px;
}
#flagid img {
margin-right: 5px;
}
#media screen and (max-width: 720px) {
table, td, tr {
display: block;
}
tr{
background: #000;
position: absolute;
right: 0;
margin-right: 50%;
transform: translate(50%);
}
.kalender td, .kalender tr {
margin-top: 0px;
margin-bottom: 50px;
text-align: center;
}
.kalender h1 {
font-size: 30pt;
margin: 0px;
text-align: center;
width: 100%;
}
.kalender img {
margin: auto;
text-align: center;
}
.kalender {
margin: auto;
text-align: center;
}
}
<table class="kalender">
<tr>
<td colspan="3">
<h1>Mei</h1>
</td>
</tr>
<tr>
<td>
<img src="Kalender/RundUmDenFinanzplatz.png" id="logos" height="150px" alt="Rund um den Finanzplatz" title="Rund um den Finanzplatz">
<h2>
Rund um den Finanzplatz Eschborn-Frankfurt
</h2>
<h4>
1 Mei 2017
</h4>
<div id="flagid"><img src="Flags/germany.png" id="flag" height="15px" alt="Duitsland" title="Duitsland">
<p>GER</p>
</div>
</td>
<td>
<img src="Kalender/GiroDItalia.png" id="logos" height="150px" alt="Giro d'Italia" title="Giro d'Italia">
<h2>
Giro d'Italia
</h2>
<h4>
5-28 Mei 2017
</h4>
<div id="flagid"><img src="Flags/italy.svg" id="flag" height="15px" alt="Italië" title="Italië">
<p>ITA</p>
</div>
</td>
<td>
<img src="Kalender/TourOfCalifornia.png" id="logos" height="150px" alt="Tour of California" title="Tour of California">
<h2>
Amgen Tour of California
</h2>
<h4>
14-20 Mei 2017
</h4>
<div id="flagid"><img src="Flags/usa.png" id="flag" height="15px" alt="USA" title="USA">
<p>USA</p>
</div>
</td>
</tr>
</table>
Related
I've added some script to my code and it's messing up formatting elsewhere in my doc. I thought maybe it had to do with where I was including it and I read this answer and tried to add async or defer but it didn't make a difference. Specifically, it's adding a block of space on the right side of my "aboutus5" div and then my footer is all squished to the left. As soon as I remove the code, the formatting goes back to normal. So I'm still not sure if it's the placement of the code or maybe just bad code I have elsewhere that is only now being affected.
Any suggestions would be much appreciated!!
Here's the specific code that's screwing things up:
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" defer></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
And here's all of the code (I know it's really bad... this is my first go at building a website):
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" defer></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<title>Budget Line of Business</title>
<style>
h1 {font-family: 'Footlight MT Light', 'Garamond';
font-size: 100px; color:#FF3B3F; font-weight: bold; margin: 0 }
h2 {font-family: 'Footlight MT Light', 'Garamond';
font-size: 52px; color: #FF3B3F; font-weight: bold; margin: 0 }
h3 {font-family: 'Footlight MT Light', 'Garamond';
font-size: 42px; color: #FF3B3F; font-weight: bold; margin: 0}
h4 {font-family: 'Footlight MT Light', 'Garamond';
font-size: 32px; color: #FF3B3F; font-weight: bold; margin: 0}
h5 {font-family: 'Georgia', 'Garamond';
font-size: 18px; color: #062f4f; font-weight: bold; margin: 0}
h6 {font-family: 'Georgia', 'Garamond';
font-size: 18px; color: #062f4f; font-weight: bold; margin: 0}
p {font-family: 'Georgia', 'Garamond';
font-size: 18px; color: #062f4f; font-weight: none; margin: 0}
ul {
list-style-type: none;
margin: 0;
padding: 10px;
overflow: hidden;
background-color: none;
}
li {
float: right;
}
li a {
display: block;
color: #062f4f;
font-family: "Footlight MT Light";
font-size:28px;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #FF3B3F;
color: #ffffff;
}
#aboutus1{
background-color:#CAEBF2;
width: 100%;
margin: 0;
}
#aboutus2{
background-color:#EFEFEF;
width: 100%;
margin: 0;
}
.aboutus3{
background-color:#CAEBF2;
width: 100%;
margin: 0;
}
.aboutus3 h{
background-color:#CAEBF2;
width: 100%;
margin: 0;
}
.aboutus3 h1 {font-family: 'Footlight MT Light', 'Garamond';
font-size: 100px; color: #062f4f; font-weight: bold; margin: 0 }
.aboutus3 h2 {font-family: 'Footlight MT Light', 'Garamond';
font-size: 52px; color: #062f4f; font-weight: bold; margin: 0 }
.aboutus3 h3 {font-family: 'Footlight MT Light', 'Garamond';
font-size: 42px; color: #FF3B3F; font-weight: bold; margin: 0}
.aboutus3 h4 {font-family: 'Footlight MT Light', 'Garamond';
font-size: 32px; color: #FF3B3F; font-weight: bold; margin: 0}
.aboutus3 h5 {font-family: 'Georgia', 'Garamond';
font-size: 22px; color: #062f4f; font-weight: bold; margin: 0}
.aboutus3 h6 {font-family: 'Georgia', 'Garamond';
font-size: 18px; color: #062f4f; font-weight: bold; margin: 0}
.aboutus3 p {font-family: 'Georgia', 'Garamond';
font-size: 18px; color: #062f4f; font-weight: none; margin: 0}
#aboutus4{
background-color:#EFEFEF;
width: 100%;
margin: 0;
}
#aboutus5{
width: 100%;
margin: 0;
}
#media
only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px) {
/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
display: block;
}
/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
td {
/* Behave like a "row" */
border: none;
position: relative;
padding-left: 37%;
}
td:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 6px;
white-space: nowrap;
}
}
.footer{
width: 100%;
height: 25vh;
background-color: #ffffff;
}
.footer a {
color: #FC4A1A;
font-size: 14px;
font-weight: bold;
text-decoration: none;
}
.footer p {
font-size: 14px; padding: 2px; color: #062f4f;
}
#footercolumn1 {
float: left; margin: 0; width: 200px; padding: 15px 280px 0 5px;
}
#footercolumn2 {
float: left; margin: 0; width: 200px; padding: 15px 280px 0 0px;
}
#footercolumn3 {
float: left; margin: 0; width: 200px; padding: 15px 0px 0 0px;
}
button {
-webkit-border-radius: 28;
-moz-border-radius: 28;
border-radius: 28px;
font-family: Arial;
color: #ffffff;
font-size: 12px;
background: #062f4f;
padding: 10px 20px 10px 20px;
text-decoration: none;
}
button:hover {
background: #FF3B3F;
text-decoration: none;
}
#ideascolumn {
float: left; margin: 0; width: 48%; height: 300px; background-color:#CAEBF2; padding: 0 0 0 2%;
}
#casestudiescolumn {
float: left; margin: 0; width: 48%; height: 300px; background-color:#062f4f; padding: 0 0 0 2%;"
}
#avatar1hover {
padding: 0px;
display: none;
text-align: center;
}
#pmhover:hover + #avatar1hover {
display: block;
}
#avatar2hover {
padding: 0px;
display: none;
text-align: center;
}
#awhover:hover + #avatar2hover {
display: block;
}
#avatar3hover {
padding: 0px;
display: none;
text-align: center;
}
#drhover:hover + #avatar3hover {
display: block;
}
#avatar4hover {
padding: 0px;
display: none;
text-align: center;
}
#mdhover:hover + #avatar4hover {
display: block;
}
#avatar5hover {
padding: 0px;
display: none;
text-align: left;
}
#rkhover:hover + #avatar5hover {
display: block;
}
#avatar6hover {
padding: 0px;
display: none;
text-align: left;
}
#mwhover:hover + #avatar6hover {
display: block;
}
#avatar7hover {
padding: 0px;
display: none;
text-align: left;
}
#lrhover:hover + #avatar7hover {
display: block;
}
#avatar8hover {
padding: 0px;
display: none;
text-align: left;
}
#ahhover:hover + #avatar8hover {
display: block;
}
span:hover + div {
display:block;
}
</style>
</head>
<body>
<div id="aboutus1">
<a href="*"><img src="images/Logo1.png" alt="Budget Line of Business Logo"
style="float:left;width:220px;height:237px;padding:10px 0px 0px 15px;"/></a>
<ul><strong>
<li>Contact</li>
<li>Ideas</li>
<li>Our Work</li>
<li>About Us</li>
<li>Home</li>
</strong>
</ul>
<br>
<br>
<br>
<br>
<br>
<br><br><br>
<br>
<br>
<h1><center>Illuminators & Inventors</center></h1><br>
<h5 style="text-align: center; padding:0px 100px;">We're a creative team of problem-solving consultants bringing fresh ideas and innovation to budget communities across the federal government.<br>Find out what we can do for you.</h5>
<br><br>
<center><button>SEE OUR WORK</button></center>
<br><br>
</div>
<div id="aboutus2">
<br><br><br>
<div class="container"><center>
<h3>What can we do for you?</h3>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo"><b>+</b></button>
<div id="demo" class="collapse">
<h5>
Onboarding<br>
Portals<br>
Workflows<br>
Data Collection<br>
Data Analytics<br>
Project Management<br>
Budget Trainings<br>
Career Development</center>
</h5>
</div>
<br>
<div id="avatartable1">
<table style="table-layout:fixed; width:100%">
<tr>
<td id="avatar4"><center>
<span id="staffmdhover"><img src="images/avatarmd.png" alt="The Mastermind Avatar"
style="width:170px;height:150px"/></span>
<div id="avatar4hover"><p>I can connect you with an agency who is working through the exact same questions.</p></div>
</center></td>
<td id="avatar1"><center>
<span id="pmhover"><img src="images/avatarpm.png" alt="The Mastermind Avatar"
style="width:180px;height:150px"/></span>
<div id="avatar1hover"><p>I am building tools behind the scenes to make your life easier.</p></div>
</center></td>
<td id="avatar2"><center>
<span id="awhover"><img src="images/avataraw.png" alt="The Mastermind Avatar"
style="width:180px;height:150px"/></span>
<div id="avatar2hover"><p>I can help you become a MAX guru.</p></div>
</center></td>
<td id="avatar3"><center>
<span id="drhover"><img src="images/avatardr.png" alt="The Mastermind Avatar"
style="width:200px;height:150px"/></span>
<div id="avatar3hover"><p>I can help you build a workflow using Collect Forms.</p></div>
</center></td>
</tr>
</table>
</div>
<br><br>
<div id="avatartable2">
<table style="table-layout:fixed; width:100%">
<tr>
<td id="avatar5">
<span id="rkhover"><img src="images/avatarrk.png" alt="The Mastermind Avatar"
style="width:200px;height:150px"/></span>
<div id="avatar5hover"><p>I can teach you how to master Excel.</p></div>
</td>
<td id="avatar6">
<span id="mwhover"><img src="images/avatarmw.png" alt="The Mastermind Avatar"
style="width:180px;height:150px"/></span>
<div id="avatar6hover"><p>I can brainstorm with you about how to streamline your budget processes.</p></div>
</td>
<td id="avatar7">
<span id="lrhover"><img src="images/avatarlr.png" alt="The Mastermind Avatar"
style="width:180px;height:150px"/></span>
<div id="avatar7hover"><p>I can point you in the direction of career development resources.</p></div>
<td id="avatar8">
<span id="ahhover"> <img src="images/avatarah.png" alt="The Mastermind Avatar"
style="width:180px;height:150px"/></span>
<div id="avatar8hover"><p>I can help you create a one-stop shop budget portal for your office.</p></div>
</td>
</tr>
</table>
</div>
<br><br>
</div>
<div class="aboutus3" style="color: #062f4f">
<br><br><br>
<center>
<h3>Our Vision</h3>
<h6 style="text-align: center; width: 60%;">Developing modern, adaptable, cost effective and optimized process, technology, and human capital solutions supporting all phases of the formulation and execution of the Federal Budget.</h6>
</center>
<br><br>
<div>
<table style="table-layout:fixed; width:100%">
<tr>
<td id="goal1">
<center><img src="images/goal1.png" alt="Goal 1: Process Picture"
style="width:425px;height:425px"/>
<h4 style="text-align: center;">Process</h4><br>
<p style="text-align: center; width: 450px;"><b>Goal 1:</b> Improve the efficiency and effectiveness of agency and central processes for forumulating and executing the Federal Budget.</p>
</center>
</td>
<td id="goal2">
<center><img src="images/goal2.png" alt="Goal 2: Technology Picture"
style="width:425px;height:425px"/>
<h4 style="text-align: center;">Technology</h4><br>
<p style="text-align: center;width: 450px;"><b>Goal 2:</b> Improve capabilities for analyzing and presenting budget, execution, planning, and financial information in support of decision making.</p></center>
</td>
<td id="goal3">
<center><img src="images/goal3.png" alt="Goal 3: Human Capital Picture"
style="width:425px;height:425px"/>
<h4 style="text-align: center;">Human Capital</h4><br>
<p style="text-align: center;width: 450px;"><b>Goal 3:</b> Enhance the effectiveness of the Federal budgeting workforce.</p></center>
</td>
</tr>
</table>
</div>
<br><br><br>
</div>
<div id="aboutus4">
<center>
<br><br><br>
<h3>Transforming budget offices since 2006</h3><br><br>
<img src="images/timeline.png" alt="Budget Line of Business Timeline"
style="width: 1100px;height:850px"/>
<br><br>
</center>
</div>
<div id="aboutus5">
<div id="ideascolumn">
<br><br><br><br>
<table style="table-layout:fixed; width:100%">
<tr>
<td id="ideaspic" style="width:20%">
<img src="images/groupavatar.png" alt="Group of Avatars"
style="width:150px;height:150px"/><br>
</td>
<td id="ideasdescription" style="width:60%">
<h3 style="text-align: left; width: 80%;">Send us a challenge</h3></center>
<br><h6 style="text-align: left; width: 70%;">If you've got a specific business challenge, we’d love to help you tackle it. Please get in touch with us.</h6></center>
<br><h6 style="text-align: left; width: 70%;">*</h6></center>
</td>
</tr>
</table>
<br><br><br>
</div>
<div id="casestudiescolumn">
<br><br><br><br>
<table style="table-layout:fixed; width:100%">
<tr>
<td id="ideaspic" style="width:20%">
<img src="images/atwork.png" alt="At Work Graphic"
style="width:150px;height:150px"/><br>
</td>
<td id="ideasdescription" style="width:60%">
<h3 style="text-align: left; width: 90%;">View our work</h3></center>
<br><h6 style="text-align: left; width: 70%; color:white">Check out some of the cool things we're working on right now.</h6></center>
<br><button>SEE OUR WORK</button>
</td>
</tr>
</table>
</div>
</div>
<div class="footer">
<div id="footercolumn1">
<h5 style="color: #062f4f;">Sign up at MAX.gov</h5><br>
<p>Have a .gov email address?<br><br> Sign up for MAX.gov here and then email us to access all of our budget resources.</p>
</div>
<div id="footercolumn2">
<h5 style="color: #062f4f;">Send us your ideas</h5><br>
<p>If you have a specific challenge for us, fill out this form with all of your details.</p></div>
<div id="footercolumn3">
<h5 style="color: #062f4f;">Get in touch
</h5><br>
<p>*<p>
Text
<br><br>
<div>
<a href="[full link to your Twitter]">
<img title="Twitter" alt="Twitter" src="https://socialmediawidgets.files.wordpress.com/2014/03/01_twitter1.png" width="35" height="35" />
</a>
<a href="[full link to your LinkedIn]">
<img title="LinkedIn" alt="LinkedIn" src="https://socialmediawidgets.files.wordpress.com/2014/03/07_linkedin1.png" width="35" height="35" />
</a>
<a href="[full link to your Facebook page]">
<img title="Facebook" alt="Facebook" src="https://socialmediawidgets.files.wordpress.com/2014/03/02_facebook1.png" width="35" height="35" />
</a>
<a href="pinterestaddress">
<img title="Pinterest" alt="Pinterest" src="https://socialmediawidgets.files.wordpress.com/2014/03/13_pinterest1.png" width="35" height="35" />
</a>
</div>
</div>
</div>
</body>
</html>
That's not a JS issue. It's because you're including Bootstrap css in
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
Which is conflicting with your own CSS. At a glance, I could see the property which is conflicting here is box-sizing
Standard solution:
Rewrite your custom CSS so it wouldn't conflict with the boostrap one.
Hack Solution (Not encouraged.. Just to show you where you're wrong):
Just include the following in your custom CSS
* {
-webkit-box-sizing: inherit;
-moz-box-sizing: inherit;
box-sizing: inherit;
}
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>
The goal is to get the Kanji, English, and Kana rows of text lined up with each other into a specific format. Such that the text is largely interchangeable and isn't hard-coded.
The Kanji and English should be evenly placed next to each other. The Kana should be aligned with the top of the second row.
It was working before, but it was hard-coded, I commented out those regions.
It should look like this:
body {
height: 100%;
padding: 0;
margin: 0;
font-size: 60%;
font-family: Verdana,sans-serif;
word-break: break-all;
}
#header {
padding-top: 10px;
width:100%;
height:286px;
padding-top: 20px;
}
#kanjiTransl{
display: inline-block;
font-size: 5.5em;
font-weight: bold;
/*position: absolute;*/
/*left: 25px;*/
/*top:15px;*/
line-height: 1.1em;
}
#jaN {
margin-bottom: 5px;
}
#kana {
display: inline-block;
vertical-align: top;
color: #777;
/*position: inline;*/
/*right: 30px;*/
/*top:130px;*/
/*font-size: 1.4em;*/
}
.top {
letter-spacing: -0.07em;
}
.bottom {
letter-spacing: -0.02em;
/*margin-left: 12px;*/
}
.topColor {
/*color: #FF2EDF;
color: #84FF00;
color: #b4FF00;*/
color: #a78317;
color: #908090;
}
.bottomColor {
/*color: #84FF00;
color: #FF2EDF;
color: #dc3616;*/
color: #9f3420;
color: #222266;
}
.headerItem {
display: inline-block;
/*height:110px;*/
/*width:900px;*/
/*position: relative;*/
/*left:.6em;*/
/*line-height: 110px;*/
font-size:15em;
font-weight:900;
}
<body>
<div id="header">
<div id="kanjiTransl">
<span id="jaN" class="topColor">驚<br>的<br></span>
<span id="jaV" class="bottomColor">速<br>記</span>
</div>
<span class="headerItem top topColor">LARGE</span><br>
<span class="headerItem bottom bottomColor">WARNING</span>
<span id="kana">ノテイショナルヴェロシティ</span>
</div>
</body>
Use this Layout and tune it to your needs:
#header {
padding-top: 10px;
width: 100%;
height: 286px;
width: 850px;
}
#jaN,
#jaV {
font-size: 5.5em;
font-weight: bold;
line-height: 1.1em;
vertical-align: top;
color: #777;
}
#kana {
float: right;
}
.top,
.bottom {
vertical-align: top;
font-weight: 900;
}
.top {
letter-spacing: -0.07em;
color: #908090;
font-size: 15em;
line-height: 0.3em;
}
.bottom {
letter-spacing: -0.02em;
font-size: 10em;
line-height: 0.3em;
color: #222266;
}
<table id="header">
<tr>
<td id="jaN">驚
<br>的</td>
<td>
<span class="top">NATIONAL</span>
</td>
</tr>
<tr>
<td id="jaV">速
<br>記</td>
<td>
<span class="bottom">VELOCITY</span>
<span id="kana">ノテイショナルヴェロシティ</span>
</td>
</tr>
</table>
I'm trying to create a result page for matches, however at the moment it looks weird when the VS is not centered at all time. My question is then how can i always center the VS?
http://jsfiddle.net/3adhoker/
.result-in-month:nth-child(even) {
background-color: #ebebeb;
}
.result-in-month {
background-color: #f3f3f3;
}
.result-in-month {
padding: 20px 30px;
font-size: 15px;
}
.gdlr-result-date {
display: inline-block;
width: 20%;
margin-right: 2%;
font-style: italic;
}
.gdlr-result-match-team-wrapper {
display: inline-block;
width: 56%;
text-align: center;
font-weight: bold;
text-transform: uppercase;
}
.gdlr-result-match-versus {
margin: 0px 2.5%;
padding: 0px 3px;
font-weight: normal;
}
.gdlr-result-match-team.gdlr-left {
margin-right: 2.5%;
text-align: right;
}
.gdlr-result-match-team.gdlr-right {
margin-left: 2.5%;
text-align: left;
}
<div class="result-in-month">
<div class="gdlr-result-date">25 Sun - 14:00</div>
<div class="gdlr-result-match-team-wrapper">
<span class="gdlr-result-match-team gdlr-left">
Bristol City
</span>
<span class="gdlr-result-match-versus">
VS
</span>
<span class="gdlr-result-match-team gdlr-right">
Real Soccer
</span>
</div>
<div class="clear"></div>
</div>
<div class="result-in-month">
<div class="gdlr-result-date">25 Sun - 14:00</div>
<div class="gdlr-result-match-team-wrapper">
<span class="gdlr-result-match-team gdlr-left">
Bristol City
</span>
<span class="gdlr-result-match-versus">
VS
</span>
<span class="gdlr-result-match-team gdlr-right">
Real MASTERCLASS
</span>
</div>
<div class="clear"></div>
</div>
You can use display: table and display: table-cell and set a fix width(check comments in css):
.result-in-month:nth-child(even) {
background-color: #ebebeb;
}
.result-in-month {
background-color: #f3f3f3;
display: table;/*add display table*/
width: 100%;
}
.result-in-month {
padding: 20px 30px;
font-size: 15px;
}
.gdlr-result-date {
display: table-cell;/*add display to table-cell*/
width: 20%;
margin-right: 2%;
font-style: italic;
}
.gdlr-result-match-team-wrapper {
display: table;/*add display table*/
text-align: center;
font-weight: bold;
text-transform: uppercase;
}
.gdlr-result-match-versus {
display: table-cell;/*add display to table-cell*/
margin: 0px 2.5%;
padding: 0px 3px;
font-weight: normal;
}
.gdlr-result-match-team.gdlr-left {
display: table-cell;/*add display to table-cell*/
margin-right: 2.5%;
text-align: right;
}
.gdlr-result-match-team.gdlr-right {
display: table-cell;
margin-left: 2.5%;
text-align: left;
width: 200px;/*set width to a fixed value for example 200px*/
}
<div class="result-in-month">
<div class="gdlr-result-date">25 Sun - 14:00</div>
<div class="gdlr-result-match-team-wrapper">
<span class="gdlr-result-match-team gdlr-left">
Bristol City
</span>
<span class="gdlr-result-match-versus">
VS
</span>
<span class="gdlr-result-match-team gdlr-right">
Real Soccer
</span>
</div>
<div class="clear"></div>
</div>
<div class="result-in-month">
<div class="gdlr-result-date">25 Sun - 14:00</div>
<div class="gdlr-result-match-team-wrapper">
<span class="gdlr-result-match-team gdlr-left">
Bristol City
</span>
<span class="gdlr-result-match-versus">
VS
</span>
<span class="gdlr-result-match-team gdlr-right">
Real MASTERCLASS
</span>
</div>
<div class="clear"></div>
</div>
Instead of using display: table-cell;, it's better to use real tables for this. For actual tabular data they are still the best solution.
.result-in-month tr:nth-child(even) {
background-color: #ebebeb;
}
.result-in-month{
border-spacing: 0px;
border-collapse: separate;
font-size: 15px;
width: 100%;
background-color: #f3f3f3;
}
.result-in-month td{
padding: 20px 30px;
}
.gdlr-result-date {
font-style: italic;
}
td.gdlr-result-match-versus {
padding: 0;
font-weight: normal;
}
.gdlr-result-match-team {
font-weight: bold;
text-transform: uppercase;
}
.gdlr-left {
text-align: right;
}
.gdlr-right {
text-align: left;
}
<table class="result-in-month">
<tr>
<td class="gdlr-result-date">25 Sun - 14:00</td>
<td class="gdlr-result-match-team gdlr-left"> Bristol City</td>
<td class="gdlr-result-match-versus">VS</td>
<td class="gdlr-result-match-team gdlr-right">Real Soccer</td>
</tr>
<tr>
<td class="gdlr-result-date">25 Sun - 14:00</td>
<td class="gdlr-result-match-team gdlr-left"> Bristol City</td>
<td class="gdlr-result-match-versus">VS</td>
<td class="gdlr-result-match-team gdlr-right">Real MASTERCLASS</td>
</tr>
</table>
JSFiddle
.result-in-month {
...
display: table-row;
}
.result-in-month > div {
display: table-cell;
padding: 10px 0;
}
.gdlr-result-match-team-wrapper > span {
display: table-cell;
padding: 0 10px;
}
Demo
My solution uses position:absolute
http://jsfiddle.net/3adhoker/4/
.result-in-month {
position: relative;
background-color: #f3f3f3;
}
.result-in-month {
padding: 20px 30px;
font-size: 15px;
}
.gdlr-result-date {
display: inline-block;
width: 20%;
margin-right: 2%;
font-style: italic;
}
.gdlr-result-match-team-wrapper {
display: inline-block;
width: 56%;
text-align: center;
font-weight: bold;
text-transform: uppercase;
position: absolute;
}
.gdlr-result-match-versus {
font-weight: normal;
position: absolute;
left: 0;
right: 0;
text-align: center;
}
.gdlr-result-match-team.gdlr-left {
text-align: right;
width: 50%;
position: absolute;
left: 0;
padding-right: 30px;
box-sizing: border-box;
}
.gdlr-result-match-team.gdlr-right {
text-align: left;
position: absolute;
padding-left: 30px;
width: 50%;
right: 0;
box-sizing: border-box;
}
I am working on an assignment and I need to place some images in a table, which normally isn't a problem for me. Today when I added the images to the table it just displays a square border with the alt text written in it. I am pretty sure that I am pointing to the right directory.
My folder structure is:
Website
css
fonts
html (Page with table in here)
js
images (Images for table in here)
#font-face{ font-family:customFont; src: url('../fonts/Balkeno.ttf'); }
* {
margin: 0;
border: 0;
padding: 0;
font-size: 12px;
font-family: arial, sans-serif;
}
body {
width: 100%;
height: 300%;
background-color: #D8D8D8;
}
nav {
font-family: customFont;
font-size: 30px;
width: 100%;
height: 40px;
position: fixed;
z-index: 50;
}
.nav-background {
width: 100%;
height: 100%;
background: #12A7CB;
opacity: 0;
position: absolute;
}
.nav-content {
position: relative;
top: 50%;
transform: translateY(-50%);
}
header {
width: 100%;
height: 320px;
}
#slideshow {
position:relative;
height:320px;
width: 100%;
}
#slideshow IMG {
position:absolute;
top:0;
left:0;
z-index:8;
width: 100%;
height: 320px;
box-shadow: 0px 5px 10px #5E5E5E;
}
#slideshow IMG.active {
z-index:10;
}
#slideshow IMG.last-active {
z-index:9;
}
#logo {
float: left;
padding-left: 100px;
padding-right: 200px;
}
#nav {
background: url(http://4.bp.blogspot.com/-dVtgikk-kOY/UprtswP0yGI/AAAAAAAADag/Og0DtZ8t_oQ/s1600/header+base.png) no-repeat scroll top left; background-color: transparent;
width:100%;
height:50px;
box-shadow: 0px 1px 10px #5E5E5E;
position:fixed;
top:0px;
}
.title {
display:none;
color:#EDEDED;
font-size:25px;
width:350px;
margin-top:6px;
margin-left:150px;
font-weight:bold;
float:left;
}
.navigation li{
list-style-image: url('navIcon.png');
float: left;
padding-right:45px;
margin-bottom: 25px;
color: black;
}
li {
}
.navigation a {
font-size: 19px;
font-family: customFont;
text-decoration:none;
color: #01ebfe;
}
.navigation a:hover {
}
.wrapper {
width: 900px;
height: 1000%;
margin-top: 25px;
margin-left: auto;
margin-right: auto;
padding: 20px;
background-color: white;
padding-top: 100px;
box-shadow: 10px 10px 5px #888888;
}
p{
font-size: 14px;
padding-bottom: 32px;
}
p:first-letter {
font-size: 32px;
color: #71CAE0;
}
h1 {
font-family: customFont;
font-size: 32px;
font-weight: bolder;
color: #12A7CB;
text-align: center;
}
h2 {
font-family: customFont;
font-size: 22px;
font-weight: bold;
color: #12A7CB;
text-align: left;
text-decoration: underline;
}
section {
width: 100%;
height: 100%;
background-color: #D8D8D8;
}
img.logo {
text-align: center;
margin: auto;
display: block;
}
img.slideshow {
width: 100%;
height: 480px;
}
footer {
width: 900px;
margin: 25px auto 0 auto;
padding-top: 20px;
padding-left: 20px;
padding-right: 20px;
background-color: white;
text-align: center;
box-shadow: 10px 10px 5px #888888;
}
.members {
padding: 10px;
display: inline-block;
background-color: #e4f4f8;
margin-top: 15px;
margin-left: 15px;
border: 1px solid #12A7CB;
float: right;
}
ol.test {
list-style-type: lower-alpha;
}
.members ol {
list-style-type: lower-alpha;
}
.members li {
display: list-item;
color: #6c6c6c;
list-style-type: lower-alpha;
padding: 5px;
margin-bottom: 5px;
margin-left: 10px;
}
/* TABLE STUFF */
table, tr, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th {
padding: 5px;
color: #12A7CB;
background-color: #e4f4f8;
}
td {
background-color: #f2eded;
width: 150px;
height: 150px;
}
/* END TABLE STUFF */
.video-wrapper {
width: 100%;
text-align: center;
}
.video-wrapper a {
color: blue;
text-decoration: none;
font-size: 12px;
font-family: arial, sans-serif;
}
.social img {
padding-top: 32px;
padding-right: 8px;
width: 48px;
height: 48px;
border: none;
}
<!DOCTYPE html>
<html>
<!--
Author: #####
Date: 11/08/2014
-->
<head>
<meta charset="utf-8" />
<title>Home - Three Doors Down</title>
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
<script src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/scroll.js"></script>
<script type="text/javascript" src="../js/header.js"></script>
</head>
<body>
<nav class="nav">
<div class="nav-background">
</div>
<div class="nav-content">
<img src="../images/navTitle.png" alt="Three Doors Down" id="logo" width=250 />
<ul class='navigation'>
<li>Home</li>
<li>Biography</li>
<li>Discography</li>
<li>Video</li>
</ul>
</div>
</nav>
<header class="header">
<div id="slideshow">
<img src="../images/header1.jpg" alt="Three Doors Down" class="active" />
<img src="../images/header2.jpg" alt="Three Doors Down" />
<img src="../images/header3.jpg" alt="Three Doors Down" />
</div>
</header>
<section>
<div class="wrapper">
<h1>Discography</h1>
<div class="disco" >
<table >
<tr>
<th>
Album
</th>
<th>
Year
</th>
<th>
Record Label
</th>
<th>
CD Cover
</th>
</tr>
<tr>
<td >
The Better Life
</td>
<td>
2000
</td>
<td>
Universal Republic
</td>
<td>
<img href="../images/theBetterLifeCover.jpg" alt="The Better Life" width="100" height="100" />
</td>
</tr>
<tr>
<td >
Away from the Sun
</td>
<td>
2002
</td>
<td>
Universal Republic
</td>
<td>
<image href="../images/awayFromTheSunCover.jpg" alt="Test" width="100" height="100" />
</td>
</tr>
<tr>
<td >
Seventeen Days
</td>
<td>
2005
</td>
<td>
Universal Republic
</td>
<td>
Cover
</td>
</tr>
<tr>
<td >
3 Doors Down
</td>
<td>
2008
</td>
<td>
Universal Republic
</td>
<td>
<image />
</td>
</tr>
<tr>
<td >
Time of My Life
</td>
<td>
2011
</td>
<td>
Universal Republic
</td>
<td>
Cover
</td>
</tr>
</table>
</div>
</div>
</section>
<footer>
<div class="nav-content">
<ul class='navigation'>
<li>Home</li>
<li>Biography</li>
<li>Discography</li>
<li>Video</li>
</ul>
</div>
</footer>
</body>
</html>
Changed href="../images/imageName.png" to src="../images/imageName.png"
change the code below code...
<image href="../images/awayFromTheSunCover.jpg" alt="Test" width="100" height="100" />
New code
<image src="../images/awayFromTheSunCover.jpg" alt="Test" width="100" height="100" />
href attr is for links i.e for a tag. For image use src attr
I checked your code. The image path is you mentioned in your HTML code is point to this link only. So check the path and make sure the images are there
It's < img src="" >, not < img href="" >.