I'm struggling with something regarding jQuery, HTML and CSS. I am currently working on a project that is to do with a railway company. I am designing the website, I completed the Home page, but I am now on the tickets page. I am using only HTML,CSS and jQuery to build this site but I just cannot get the tickets page to work properly. I created a ticket section that has a purchase button after you selected if you are an adult, but all the purchase buttons appear if just one of the trips's, can someone please help me out, the purchase button all have the same class name but I know that using $(this).find(".className").show(); always works but it does not seem to now. I also tried $("tr").find(".className").show(); as well as $("this").closest(".classname").show();
// Trips Page Functionality
$("input").click(function() {
$("tr").first(".purchase-button").fadeIn(800);
});
//footer functionality
$("#social-media-group").mouseenter(function() {
$(this).find(".facebook-block").attr("src", "assets/icons/facebook-hover.svg");
});
$("#social-media-group").mouseleave(function() {
$(this).find(".facebook-block").attr("src", "assets/icons/facebook.svg");
});
$("#social-media-group").mouseenter(function() {
$(this).find(".instagram-block").attr("src", "assets/icons/instagram-hover.svg");
});
$("#social-media-group").mouseleave(function() {
$(this).find(".instagram-block").attr("src", "assets/icons/instagram.svg");
});
$("#social-media-group").mouseenter(function() {
$(this).find(".youtube-block").attr("src", "assets/icons/youtube-hover.svg");
});
$("#social-media-group").mouseleave(function() {
$(this).find(".youtube-block").attr("src", "assets/icons/youtube.svg");
});
});
* {
padding: 0;
margin: 0;
}
body {
overflow-x: hidden;
}
#container {
background-color: #000000;
width: 100%;
height: auto;
}
/* Nav-Bar Styling */
#overlay {
position: fixed;
background-color: rgba(203, 187, 42, 0.6);
width: 100%;
z-index: 2;
}
#header {
background-color: black;
height: 150px;
text-align: center;
}
#phone-div {
margin-top: 0px;
position: relative;
right: 350px;
bottom: 100px;
}
h6 {
font-family: 'Prata', serif;
color: white;
font-size: 12px;
}
#email-div {
margin-top: 0px;
position: relative;
left: 350px;
bottom: 150px;
}
#dropdown {
width: 700px;
height: 50px;
margin: 0 auto;
}
#dropdown:hover {
transition: 0.2s;
}
li {
text-decoration: none;
display: inline;
margin-left: 150px;
text-align: center;
position: relative;
left: -50px;
font-family: 'Prata', serif;
position: relative;
top: 14px;
color: white;
}
li:hover {
text-shadow: 2px 2px 5px black;
transition: 0.2s;
cursor: pointer;
}
a {
text-decoration: none;
}
/* End of Nav Bar Styling */
/* Container styling */
h1 {
font-family: 'MonteCarlo', 'sans-serif';
color: white;
position: relative;
top: 220px;
left: 50px;
text-align: center;
font-size: 62px;
}
h2 {
position: relative;
top: 300px;
margin-left: 120px;
margin-right: 120px;
color: white;
font-family: 'Prata', 'sans-serif';
border-radius: 10px;
text-align: center;
}
/* Tickets Section Styling */
#tickets-group {
width: 100%;
height: auto;
margin: 50px;
;
border-radius: 10px;
position: relative;
top: -2200px;
right: 50px;
}
table {
width: 70%;
position: relative;
left: 20px;
border-collapse: collapse;
position: relative;
left: 250px;
background-color: rgba(0, 0, 0, 0.5);
border: none;
}
th {
color: white;
font-family: 'Prata', 'sans-serif';
text-align: center;
border-bottom: 1px solid rgba(255, 255, 255, 0.5);
border-radius: 10px;
}
td {
color: white;
text-align: center;
border-right: 3px solid rgba(0, 0, 0, 0.5);
font-family: 'Prata', serif;
}
input:hover {
cursor: pointer;
}
.trips:hover {
cursor: pointer;
background-color: rgba(203, 187, 42, 0.6);
transition: 0.3s;
}
.purchase-button {
text-align: center;
position: relative;
left: 43%;
font-size: 24px;
border-bottom: none;
}
table:hover {
box-shadow: 3px 1px 20px black;
transition: 0.3s ease;
}
h3 {
font-family: 'Prata', serif;
font-size: 24px;
}
.purchase-button:hover {
transition: 0.3s;
cursor: pointer;
background-color: rgba(0, 0, 0, 0.5)
}
/* Footer Styling */
#footer {
width: 100%;
float: left;
background-color: #CBBB2A;
overflow: hidden;
}
#social-media-group img {
margin: 20px;
position: relative;
left: 40%;
bottom: 130px;
}
/* End of Footer Styling */
<!DOCTYPE html>
<html>
<head>
<meta name="author" content="Wiaan Duvenhage">
<meta name="lecturer" content="Armand Pretorius">
<meta name="assessment" content="Website-root">
<meta name="studentnumber" content="200307">
<meta name="subject" content="DV100">
<meta name="class" content="Class 2">
<link rel="stylesheet" href="../css/trips-page.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Julius+Sans+One&family=MonteCarlo&family=Prata&display=swap" rel="stylesheet">
<title>Velocity Railways</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="../js/data.js"></script>
<script src="../js/index.js"></script>
</head>
<body>
<div id="container">
<div id="overlay">
<div id="header">
<img src="../assets/logo.svg" alt="velocity_logo" width="200px">
<div id="phone-div">
<img src="../assets/icons/phone .svg" alt="phone_icon" width="30px">
<h6>+27 12 785 3355</h6>
</div>
<!--Phone Div-->
<div id="email-div">
<img src="../assets/icons/email.svg" alt="phone_icon" width="30px">
<h6>enquiries#velocityrailways.co.za</h6>
</div>
<!--Email Div-->
</div>
<!--Header-->
<div id="dropdown">
<ul>
<a href="pages/trips-page.html">
<li>Trips</li>
</a>
<li>Purchase Tickets</li>
<li>About</li>
</ul>
</div>
<!-- Dropdown -->
</div>
<!--Overlay-->
<div id="inner-container">
<h1>Trips Page</h1>
<div id="introduction-body">
<h2>Welcome To Trips Page Section! Feel free to book your tickets on this page and after selecting it, proceeding to the next page, which is the Purchase Tickets Page!</h2>
</div>
<img class="home-page-image" src="../img/iccup-nNV3q_nhGKQ-unsplash.jpg" width="100%" height="auto">
<div id="tickets-group">
<table>
<tr>
<th>
<h3>FROM</h3>
</th>
<th>
<h3>TO</h3>
</th>
<th>
<h3>DEPART</h3>
</th>
<th>
<h3>ARRIVE</h3>
</th>
<th>
<h3>ADULT</h3>
</th>
</tr>
<tr class="trips">
<td>Pretoria</td>
<td>Johannesburg</td>
<td>09:00</td>
<td>10:00</td>
<td><label><input type="checkbox"><span class="checkmark"></span></label></td>
</tr>
<tr>
<th class="purchase-button">Purchase</th>
</tr>
<tr class="trips">
<td>Pretoria</td>
<td>Johannesburg</td>
<td>09:00</td>
<td>10:00</td>
<td><label><input type="checkbox"><span class="checkmark"></span></label></td>
</tr>
<tr>
<th class="purchase-button">Purchase</th>
</tr>
<tr class="trips">
<td>Pretoria</td>
<td>Johannesburg</td>
<td>09:00</td>
<td>10:00</td>
<td><label><input type="checkbox"><span class="checkmark"></span></label></td>
</tr>
<tr>
<th class="purchase-button">Purchase</th>
</tr>
<tr class="trips">
<td>Pretoria</td>
<td>Johannesburg</td>
<td>09:00</td>
<td>10:00</td>
<td><label><input type="checkbox"><span class="checkmark"></span></label></td>
</tr>
<tr>
<th class="purchase-button">Purchase</th>
</tr>
</table>
</div>
</div>
<div id="footer">
<img src="../assets/logo-footer.svg" alt="velocity_logo" width="200px">
<div id="social-media-group">
<img src="../assets/icons/facebook.svg" alt="facebook-logo" width="50px">
<img src="../assets/icons/instagram.svg" alt="facebook-logo" width="50px">
<img src="../assets/icons/youtube.svg" alt="facebook-logo" width="50px">
</div>
</div>
</div>
<!-- End of Outer Container -->
</body>
</html>
Default your purchase button should be hide by CSS property like .purchase-button{display: none;}.
After that you need to check condition of checkbox is checked or Not as respectively show/hide purchase-button through jQuery functionality.
And need to add colspan="5" attribute on .purchase-button element for standard html structure.
$(document).on('change', 'input[type="checkbox"]', function () {
if($(this).is(':checked')){
$(this).parents('.trips').next().find('.purchase-button').show();
}else{
$(this).parents('.trips').next().find('.purchase-button').hide();
}
});
* {
padding: 0;
margin: 0;
}
body {
overflow-x: hidden;
}
#container {
background-color: #000000;
width: 100%;
height: auto;
}
/* Nav-Bar Styling */
#overlay {
position: relative;
background-color: rgba(203, 187, 42, 0.6);
width: 100%;
z-index: 2;
}
#header {
background-color: black;
height: 150px;
text-align: center;
}
#phone-div {
margin-top: 0px;
position: relative;
}
#email-div {
margin-top: 0px;
position: relative;
}
h6 {
font-family: 'Prata', serif;
color: white;
font-size: 12px;
}
#dropdown {
width: 100%;
max-width: 700px;
height: 50px;
margin: 0 auto;
}
#dropdown:hover {
transition: 0.2s;
}
li {
text-decoration: none;
display: inline;
margin-left: 150px;
text-align: center;
position: relative;
left: -50px;
font-family: 'Prata', serif;
position: relative;
top: 14px;
color: white;
}
li:hover {
text-shadow: 2px 2px 5px black;
transition: 0.2s;
cursor: pointer;
}
a {
text-decoration: none;
}
/* End of Nav Bar Styling */
/* Container styling */
h1 {
font-family: 'MonteCarlo', 'sans-serif';
color: white;
position: relative;
text-align: center;
font-size: 62px;
}
h2 {
font-size: 32px;
position: relative;
color: white;
font-family: 'Prata', 'sans-serif';
border-radius: 10px;
text-align: center;
}
/* Tickets Section Styling */
#tickets-group {
width: 100%;
max-width: 1320px;
height: auto;
margin: 50px auto;
border-radius: 10px;
position: relative;
}
table {
width: 100%;
position: relative;
border-collapse: collapse;
position: relative;
background-color: rgba(0, 0, 0, 0.5);
border: none;
}
th {
color: white;
font-family: 'Prata', 'sans-serif';
text-align: center;
border-bottom: 1px solid rgba(255, 255, 255, 0.5);
border-radius: 10px;
padding: 10px;
}
td {
color: white;
text-align: center;
border-right: 3px solid rgba(0, 0, 0, 0.5);
font-family: 'Prata', serif;
padding: 10px;
}
input:hover {
cursor: pointer;
}
.trips:hover {
cursor: pointer;
background-color: rgba(203, 187, 42, 0.6);
transition: 0.3s;
}
.purchase-button {
text-align: center;
position: relative;
font-size: 24px;
border-bottom: none;
display: none;
}
table:hover {
box-shadow: 3px 1px 20px black;
transition: 0.3s ease;
}
h3 {
font-family: 'Prata', serif;
font-size: 24px;
}
.purchase-button:hover {
transition: 0.3s;
cursor: pointer;
background-color: rgba(0, 0, 0, 0.5)
}
/* Footer Styling */
#footer {
width: 100%;
float: none;
background-color: #CBBB2A;
overflow: hidden;
text-align: center;
padding: 15px;
}
#social-media-group{
width: 100%;
max-width: 1320px;
margin: 0 auto;
}
#social-media-group img {
margin: 10px 10px 0 10px;
position: relative;
}
/* End of Footer Styling */
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Julius+Sans+One&family=MonteCarlo&family=Prata&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<div id="container">
<div id="overlay">
<div id="header">
<img src="../assets/logo.svg" alt="velocity_logo" width="200px">
<div id="phone-div">
<img src="../assets/icons/phone .svg" alt="phone_icon" width="30px">
<h6>+27 12 785 3355</h6>
</div>
<!--Phone Div-->
<div id="email-div">
<img src="../assets/icons/email.svg" alt="phone_icon" width="30px">
<h6>enquiries#velocityrailways.co.za</h6>
</div>
<!--Email Div-->
</div>
<!--Header-->
<div id="dropdown">
<ul>
<li>Trips</li>
<li>Purchase Tickets</li>
<li>About</li>
</ul>
</div>
<!-- Dropdown -->
</div>
<!--Overlay-->
<div id="inner-container">
<h1>Trips Page</h1>
<div id="introduction-body">
<h2>
Welcome To Trips Page Section! Feel free to book your tickets on this page and after selecting it,
proceeding to the next page, which is the Purchase Tickets Page!
</h2>
</div>
<img class="home-page-image" src="../img/iccup-nNV3q_nhGKQ-unsplash.jpg" width="100%" height="auto">
<div id="tickets-group">
<table>
<tr>
<th><h3>FROM</h3></th>
<th><h3>TO</h3></th>
<th><h3>DEPART</h3></th>
<th><h3>ARRIVE</h3></th>
<th><h3>ADULT</h3></th>
</tr>
<tr class="trips">
<td>Pretoria</td>
<td>Johannesburg</td>
<td>09:00</td>
<td>10:00</td>
<td><label><input type="checkbox"><span class="checkmark"></span></label></td>
</tr>
<tr>
<th colspan="5" class="purchase-button">Purchase</th>
</tr>
<tr class="trips">
<td>Pretoria</td>
<td>Johannesburg</td>
<td>09:00</td>
<td>10:00</td>
<td><label><input type="checkbox"><span class="checkmark"></span></label></td>
</tr>
<tr>
<th colspan="5" class="purchase-button">Purchase</th>
</tr>
<tr class="trips">
<td>Pretoria</td>
<td>Johannesburg</td>
<td>09:00</td>
<td>10:00</td>
<td><label><input type="checkbox"><span class="checkmark"></span></label></td>
</tr>
<tr>
<th colspan="5" class="purchase-button">Purchase</th>
</tr>
<tr class="trips">
<td>Pretoria</td>
<td>Johannesburg</td>
<td>09:00</td>
<td>10:00</td>
<td><label><input type="checkbox"><span class="checkmark"></span></label></td>
</tr>
<tr>
<th colspan="5" class="purchase-button">Purchase</th>
</tr>
</table>
</div>
</div>
<div id="footer">
<img src="../assets/logo-footer.svg" alt="velocity_logo" width="200px">
<div id="social-media-group">
<img src="../assets/icons/facebook.svg" alt="facebook-logo" width="50px">
<img src="../assets/icons/instagram.svg" alt="facebook-logo" width="50px">
<img src="../assets/icons/youtube.svg" alt="facebook-logo" width="50px">
</div>
</div>
</div>
<!-- End of Outer Container -->
You could select the parent tr with .parents('.trips'), then the next tr with .next() and then the button with .find('.purchase-button'):
$('input[type="checkbox"]').on('click', function() {
$(this).parents('.trips').next().find('.purchase-button').show();
});
Related
I was trying to make a navbar and adding elements next to it, but I don't know why the other element is positioning in a higher place, making the navbar to move down.
This is what's happening
What do I need to do so the navbar stays where it's supposed to be
and have the ability to move freely the other objects, so I can place them in the middle of the website without problem
Here is the code:
body{
margin: 0;
}
header{
background: #224fb1;
color: white;
display: flex;
justify-self: space-between;
align-items: center;
box-shadow: 0 1px 4px rgba(0, 0, 0, 1.12);
}
#iconmenu{
margin-left: 25px;
margin-right: 25px;
}
.title{
display: flex;
justify-self: space-between;
align-items: center;
}
.titphp{
font-size: large;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}
#navbar{
background-color: #eeeeee;
border-radius: 5px;
/* height: 100vh; */
height: 860px;
width: 170px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 1.12);
display: inline-block;
margin-top: 5px;
margin-right: 5px;
}
ul{
padding: 0;
text-decoration: none;
color: #444;
list-style: none;
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
text-align: center;
}
#opcnav{
padding: 0;
background-color: white;
height: 25px;
margin: 5px;
border-radius: 5px;
}
#opcnav:hover{
background-color: #91B6E4;
font-weight: bold;
transition-duration: 0.2s;
}
#botnav{
text-decoration: none;
color: #444;
display: block;
}
#botnav:hover{
border-radius: 5px;
text-decoration: none;
color: #444;
background-color: #91B6E4;
color: white;
}
#datosalumno{
background-color: #eeeeee;
margin: 0px;
text-align: center;
justify-content: center;
box-shadow: 0 1px 4px rgba(0, 0, 0, 1.12);
display: inline-block;
border-radius: 5px;
}
#fotoalumno{
margin: 10px;
/* border-radius: 10px; */
}
#calendar{
margin: 5px;
}
/* Parte del calendario */
#calendario{
border: 4px double black;
max-width: 536px;
background-color: #fffafa;
text-align: center;
display: inline-block;
}
#diasc{
border: 1px solid black;
border-collapse: separate;
border-spacing: 4px;
}
#diasc th, #diasc td {
font: normal 14pt arial;
width: 70px;
height: 30px;
}
#diasc th{
color: #990099;
background-color: #5ecdec;
}
#diasc td{
color: #492736;
background-color: #9bf5ff;
}
#fechaactual {
font: bold 12pt arial;
padding: 0.4em;
}
#fechaactual i {
cursor: pointer;
}
#fechaactual i:hover{
color: blue;
text-decoration: underline;
}
#buscafecha{
background-color: #663366;
color: #9bf5ff;
padding: 5px;
}
#buscafecha select, #buscafecha input {
background-color: #9bf5ff;
color: #990099;
font: bold 10pt arial;
}
#buscafecha [type=text]{
text-align: center;
}
#buscafecha [type=button]{
cursor: pointer;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="prac/calestilo.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="calendario.js"></script>
<title>Calendario 2.0</title>
</head>
<body>
<div class="cab">
<header>
<div>
<img src="prac/icons/hambu.png" alt="Menu" id="iconmenu"
height="40px"
>
</div>
<div>
<h1 class="title">Calendario</h1>
</div>
</header>
</div>
<div id="navbar">
<img src="prac/icons/logo_uni_2016.png" alt="Logo Uni"
height="50px">
<ul id="listnav" class="nav-menu">
<li id="opcnav"><a id="botnav" href="http://localhost/calendario/Prac/miinfo.html" title="Mi Perfil" target="blank"><img src="prac/icons/user.png" alt="Mi Información"
height="15px"> Mi Perifl</a>
<li id="opcnav"> <img src="prac/icons/asistencia.png" alt="Asistencia"
height="15px"> Asistencia
<li id="opcnav"><a id="botnav" href="http://localhost/calendario/Calendario.php" title="Calendario" target="blank" > <img src="prac/icons/calendar.png" alt="Calendario"
height="15px"> Calendario</a>
<li id="opcnav">En Proceso...
</ul>
</div>
<!-- Esta es la parte del calendario -->
<div id="calendario">
<div id="anterior" onclick="mesantes()"></div>
<div id="posterior" onclick="mesdespues()"></div>
<h2 id="titulos"></h2>
<table id="diasc">
<tr id="fila0"><th></th><th></th><th></th><th></th><th></th><th></th><th></th></tr>
<tr id="fila1"><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr id="fila2"><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr id="fila3"><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr id="fila4"><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr id="fila5"><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr id="fila6"><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
</table>
<div id="fechaactual"><i onclick="actualizar()">HOY: </i></div>
<div id="buscafecha">
<form action="#" name="buscar">
<p>Buscar ... MES
<select name="buscames">
<option value="0">Enero</option>
<option value="1">Febrero</option>
<option value="2">Marzo</option>
<option value="3">Abril</option>
<option value="4">Mayo</option>
<option value="5">Junio</option>
<option value="6">Julio</option>
<option value="7">Agosto</option>
<option value="8">Septiembre</option>
<option value="9">Octubre</option>
<option value="10">Noviembre</option>
<option value="11">Diciembre</option>
</select>
... AÑO ...
<input type="text" name="buscaanno" maxlength="4" size="4" />
...
<input type="button" value="BUSCAR" onclick="mifecha()" />
</p>
</form>
</div>
</div>
</body>
</html>
Suggestion
In today era, we have some powerful things like flex and grid to build a website layout. So plz try to use display: flex; or display: grid; insted of display: inline-block;.
How to do
Just wrap the <nav id="navbar"> and <div id="calendario"> to the <div> and give it a style display: flex. And then there's no need for display: inline-block; just remove it from both childs. One more fix to adjust the height of <div id="calendario"> by height: fit-content;
body {
margin: 0;
}
header {
background: #224fb1;
color: white;
display: flex;
justify-self: space-between;
align-items: center;
box-shadow: 0 1px 4px rgba(0, 0, 0, 1.12);
}
#iconmenu {
margin-left: 25px;
margin-right: 25px;
}
.title {
display: flex;
justify-self: space-between;
align-items: center;
}
.titphp {
font-size: large;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}
#navbar {
background-color: #eeeeee;
border-radius: 5px;
/* height: 100vh; */
height: 860px;
width: 170px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 1.12);
/* display: inline-block; */
margin-top: 5px;
margin-right: 5px;
}
ul {
padding: 0;
text-decoration: none;
color: #444;
list-style: none;
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
text-align: center;
}
#opcnav {
padding: 0;
background-color: white;
height: 25px;
margin: 5px;
border-radius: 5px;
}
#opcnav:hover {
background-color: #91B6E4;
font-weight: bold;
transition-duration: 0.2s;
}
#botnav {
text-decoration: none;
color: #444;
display: block;
}
#botnav:hover {
border-radius: 5px;
text-decoration: none;
color: #444;
background-color: #91B6E4;
color: white;
}
#datosalumno {
background-color: #eeeeee;
margin: 0px;
text-align: center;
justify-content: center;
box-shadow: 0 1px 4px rgba(0, 0, 0, 1.12);
display: inline-block;
border-radius: 5px;
}
#fotoalumno {
margin: 10px;
/* border-radius: 10px; */
}
#calendar {
margin: 5px;
}
/* Parte del calendario */
#calendario {
border: 4px double black;
max-width: 536px;
background-color: #fffafa;
text-align: center;
/* display: inline-block; */
}
#diasc {
border: 1px solid black;
border-collapse: separate;
border-spacing: 4px;
}
#diasc th,
#diasc td {
font: normal 14pt arial;
width: 70px;
height: 30px;
}
#diasc th {
color: #990099;
background-color: #5ecdec;
}
#diasc td {
color: #492736;
background-color: #9bf5ff;
}
#fechaactual {
font: bold 12pt arial;
padding: 0.4em;
}
#fechaactual i {
cursor: pointer;
}
#fechaactual i:hover {
color: blue;
text-decoration: underline;
}
#buscafecha {
background-color: #663366;
color: #9bf5ff;
padding: 5px;
}
#buscafecha select,
#buscafecha input {
background-color: #9bf5ff;
color: #990099;
font: bold 10pt arial;
}
#buscafecha [type=text] {
text-align: center;
}
#buscafecha [type=button] {
cursor: pointer;
}
#main{
display: flex;
}
#calendario {
height: fit-content;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="prac/calestilo.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="calendario.js"></script>
<link rel="stylesheet" href="styles.css">
<title>Calendario 2.0</title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
</head>
<body>
<div class="cab">
<header>
<div>
<img src="prac/icons/hambu.png" alt="Menu" id="iconmenu" height="40px">
</div>
<div>
<h1 class="title">Calendario</h1>
</div>
</header>
</div>
<div id="main">
<div id="navbar">
<img src="prac/icons/logo_uni_2016.png" alt="Logo Uni" height="50px">
<ul id="listnav" class="nav-menu">
<li id="opcnav"><a id="botnav" href="http://localhost/calendario/Prac/miinfo.html" title="Mi Perfil"
target="blank"><img src="prac/icons/user.png" alt="Mi Información" height="15px"> Mi Perifl</a>
<li id="opcnav"> <img src="prac/icons/asistencia.png" alt="Asistencia" height="15px"> Asistencia
<li id="opcnav"><a id="botnav" href="http://localhost/calendario/Calendario.php" title="Calendario"
target="blank"> <img src="prac/icons/calendar.png" alt="Calendario" height="15px">
Calendario</a>
<li id="opcnav">En Proceso...
</ul>
</div>
<!-- Esta es la parte del calendario -->
<div id="calendario">
<div id="anterior" onclick="mesantes()"></div>
<div id="posterior" onclick="mesdespues()"></div>
<h2 id="titulos"></h2>
<table id="diasc">
<tr id="fila0">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr id="fila1">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr id="fila2">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr id="fila3">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr id="fila4">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr id="fila5">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr id="fila6">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<div id="fechaactual"><i onclick="actualizar()">HOY: </i></div>
<div id="buscafecha">
<form action="#" name="buscar">
<p>Buscar ... MES
<select name="buscames">
<option value="0">Enero</option>
<option value="1">Febrero</option>
<option value="2">Marzo</option>
<option value="3">Abril</option>
<option value="4">Mayo</option>
<option value="5">Junio</option>
<option value="6">Julio</option>
<option value="7">Agosto</option>
<option value="8">Septiembre</option>
<option value="9">Octubre</option>
<option value="10">Noviembre</option>
<option value="11">Diciembre</option>
</select>
... AÑO ...
<input type="text" name="buscaanno" maxlength="4" size="4" />
...
<input type="button" value="BUSCAR" onclick="mifecha()" />
</p>
</form>
</div>
</div>
</div>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
</body>
</html>
Please help me, i am having a tough time with a box shadow, i've been looking for some time now and didn't find a solution
https://jsfiddle.net/4xqavefz/ .input1 / .input2 / .input3
Above is the whole code, in css you are looking for the .input1 ,.input2, and .input3
I am trying to make the box shadow to be seen through the input like below image
image
You could keep the shadow as it is (it falls outside the element) and add in the rest of the coloring with a background-image which is a linear-gradient.
This snippet puts that background-image displaced by 12px (=14px minus a border width).
#font-face {
font-family: futuraptbook;
src: url(../fonts/futuraptbook.ttf);
}
#font-face {
font-family: futuraptdemi;
src: url(../fonts/futuraptbook.ttf);
}
body {
background: black;
}
.block {
display: block;
}
.center {
margin-left: auto;
margin-right: auto;
}
.logo {
width: 185;
height: 161;
}
.p1 {
color: white;
font-size: 24px;
text-align: center;
width: 620px;
height: 63px;
line-height: 32px;
font-family: futuraptbook;
margin-bottom: 100px;
}
.th1 {
color: white;
font-size: 32px;
line-height: 43px;
font-family: futuraptdemi;
padding-bottom: 30px;
}
.age {
font-size: 15px;
text-align: left;
line-height: 20px;
font-family: futuraptdemi;
color: white;
letter-spacing: 1.5px;
}
td input[class^='input'],
td input[class^=" input"] {
width: 176px;
height: 60px;
border: 2px solid #FFFFFF;
background: rgba(0, 0, 0, 0);
background-image: linear-gradient(#54B3A1, #54B3A1);
background-position: 12px 12px;
background-repeat: no-repeat;
box-shadow: 14px 14px 0px 0px #54B3A1;
margin-right: 40px;
color: white;
font-size: 18px;
font-family: futuraptbook;
text-align: center;
}
td input[class^='input']:focus,
td input[class^=" input"] {
box-shadow: 0px 0px 0px 0px black;
width: 218px;
margin-right: -1px;
margin-left: -1px;
border-radius: 0px;
background-image: linear-gradient(transparent, transparent);
}
td input[class^='input']:valid,
td input[class^=" input"] {
box-shadow: 14px 14px 0px 0px #54B3A1;
background-image: linear-gradient(#54B3A1, #54B3A1);
background-position: 12px 12px;
background-repeat: no-repeat;
width: 218px;
margin-right: -1px;
margin-left: -1px;
border-radius: 0px;
}
.btn {
border-radius: 27px;
background: #D94016;
width: 300px;
height: 50px;
margin-top: 50px;
}
.ftr {
position: relative;
text-align: center;
width: 100%;
margin-top: 100px;
margin-bottom: 40px;
}
.under {
text-decoration: none;
position: relative;
}
.under:after {
position: absolute;
content: '';
height: 1px;
bottom: -4px;
width: 75%;
background: #54B3A1;
left: 0px;
}
.logo:hover {
cursor: pointer;
}
.cookiesdiv {
border: 1px solid white;
padding: 10px;
bottom: 0px;
width: 942px;
}
.pcook {
width: 95%;
font-size: 15px;
text-align: left;
color: white;
font-family: futuraptbook;
}
.ckbtn1 {
border-radius: 27px;
background: #54B3A1;
width: 72px;
height: 27px;
color: white;
font-family: futuraptdemi;
font-size: 13px;
}
.ckbtn2 {
border: 1px solid white;
border-radius: 27px;
background: black;
width: 134px;
height: 27px;
color: white;
font-family: futuraptdemi;
font-size: 13px;
}
<html>
<head>
<link rel="stylesheet" href="css/agev.css">
</head>
<body>
<img src="images/viennalogo.png" class="logo center block">
<div>
<p class="p1 center">Welcome! In order to continue your visit on Vienna distribution, you must be of legal drinking age.</p>
</div>
<table class="center">
<tr>
<th colspan="3" class="th1">WHEN WER<span class="under">E Y</span>OU BORN</th>
</tr>
<tr>
<td><label class="age" for="day">DAY (DD)</label></td>
<td><label class="age" for="month">MONTH (MM)</label></td>
<td><label class="age" for="year">YEAR (YYYY)</label></td>
</tr>
<tr>
<td><input type="text" class="input1" name="day" required></td>
<td><input type="text" class="input2" name="month" required></td>
<td><input type="text" class="input3" name="year" required></td>
</tr>
<tr>
<td colspan="3"><button class="btn center block">I AM OF LEGAL DRINKING AGE</button></td>
</tr>
</table>
<footer class="ftr">
<img src="images/facebooklogo.png">
<img src="images/instalogo.png">
<img src="images/twitterlogo.png">
</footer>
<div class="cookiesdiv center">
<table>
<tr>
<td>
<p class="pcook">We use cookies on our website to give you the most relevant experience. By clicking “Accept”, you consent to the use of ALL cookies. Alternatively, you may click “Cookie Settings” to provide a controlled consent.</p>
</td>
<td>
<button class="ckbtn1">ACCEPT</button>
</td>
<td>
<button class="ckbtn2">COOKIE SETTINGS</button>
</td>
</tr>
</table>
</div>
</body>
</html>
Note - to prevent having to repeat the settings for each of the 3 inputs the snippet instead selects by the class beginning with 'input'. You will want to refine that if there is more structure added later to be sure of getting the right elements.
I noted that there was no validation in the sense of making sure that the numbers typed were both numbers and of the right length, but appreciate this is a different question.
The issue is that box-shadow wraps around an element, so you cant use box-shadow here instead you should use an absolute div like in the below example
<td>
<input type="text" class="input1" name="day" required>
<div style="
position: absolute;
width: 80%;
height: 100%;
background: #54b3a1;
top: 16px;
left: 16px;
z-index: 22;
">
</div>
</td>
working example https://jsfiddle.net/ahforcuw/1/
I tried to create my first E-mail template, when I open it by Live Server it looks good, but when I send it via mail with putsmail it looks very crappy and broken.
I tried to upload pictures online but it doesn't change anything.
On code snippet it also looks good so I think that code is fine?
I have run out of ideas, is there anyone who can help me?
Mail preview
-
Live Server preview
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VANS E-Mail Template</title>
<style type="text/css">
body {
margin: 0;
background-color: #cccccc;
}
table {
border-spacing: 0;
}
td {
padding: 0;
}
img {
border: 0;
}
.wrapper {
width: 100%;
table-layout: fixed;
background-color: #cccccc;
padding-bottom: 40px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.main {
background-color: #ffffff;
margin: 0 auto;
width: 100%;
max-width: 600px;
border-spacing: 0;
color: #4a4a4a;
}
.two-columns {
text-align: center;
font-size: 0;
padding: 40px 0;
}
.two-columns .column {
width: 100%;
max-width: 300px;
display: inline-block;
vertical-align: top;
text-align: center;
font-size: 18px;
padding-bottom: 40px;
}
.button {
background-color: #C9192E;
color: #ffffff;
text-decoration: none;
padding: 15px 20px;
border-radius: 2px;
}
.banner {
max-width: 600px;
}
.container {
position: relative;
text-align: center;
color: white;
margin-top: 0px;
}
.container2 {
position: relative;
text-align: center;
margin-top: -60px;
display: block;
}
.background {
height: 70px;
width: 600px;
margin-top: 0px;
background-color: #1C1C1C;
}
.background2 {
height: 70px;
width: 600px;
background-color: #1C1C1C;
background: #1C1C1C;
background-size: 100%;
}
.background-text {
font-size: 40px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-decoration: none;
color: white;
}
.background-text2 {
font-size: 40px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-decoration: none;
color: white;
white-space: nowrap;
}
.first {
margin-left: 15px;
margin-top: 15px;
z-index: 9;
display: block;
position: absolute;
}
.first-text {
font-size: 32px;
padding: 0;
margin-top: -30px;
margin-left: 45px;
color: #272727;
}
.first2-text {
font-size: 22px;
padding: 0;
margin-top: -30px;
margin-left: 50px;
color: #272727;
}
.second {
margin-left: 315px;
margin-top: 40px;
display: block;
position: absolute;
}
.second-text {
font-size: 32px;
padding: -300px;
margin-left: 380px;
line-height: 0;
color: #272727;
}
.second2-text {
font-size: 22px;
padding: -300px;
margin-left: 380px;
line-height: 0;
color: #272727;
}
.third {
margin-top: 290px;
margin-left: 15px;
}
.third-text {
font-size: 32px;
padding: -300px;
margin-top: -275px;
margin-left: 340px;
line-height: 0;
color: #272727;
}
.third2-text {
font-size: 22px;
padding: -300px;
margin-left: 340px;
line-height: 0;
background: "#D0CFC8";
background-size: "100%";
color: #272727;
}
.see-more {
margin-left: 380px;
margin-top: 80px;
font-size: 26px;
}
.background-rect {
background: #D0CFC8;
height: 150px;
width: 600px;
}
.icons {
position: relative;
display: block;
margin-top: -58px;
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body>
<center class="wrapper">
<table class="main" width="100%">
<!-- LOGO SECTION -->
<!-- BANNER IMAGE !! -->
<tr>
<td>
<img src="https://i.ibb.co/MPsmk9q/banner.png" alt="Banner" class="banner">
</td>
</tr>
<!-- BACKGROUND COLOR TEXT !!-->
<tr>
<td class="container">
<div class="background"></div>
SHOP CLASSICS
</td>
</td>
</tr>
<!-- TWO COLUMN SECTION -->
<tr>
<td>
<table width="100%">
<tr>
<td class="two-columns" style="background-color: #D8D7D3; padding-bottom: 0;">
<table class="column">
<tr>
<td>
<img src="https://i.ibb.co/YfSffKs/women.webp" alt="Women" title="Women" width="300" style="max-width: 300px; padding-bottom: 60px; padding-top: 30px;">
BUY WOMENS
</td>
</tr>
</table>
<table class="column">
<tr>
<td class="column">
<a href="#"><img src="https://i.ibb.co/bvHdthf/men.webp" alt="Men" title="Men" width="300" style="max-width: 300px; padding-bottom: 60px; padding-top: 30px; -webkit-transform: scaleX(-1);
transform: scaleX(-1);"></a>
</a>
BUY MEN
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="container">
<div class="background"></div>
OUR LATEST COLLECTION
</td>
</tr>
<!-- FOOTER SECTION -->
<tr style="background: #D0CFC8; background-size: 100%;">
<td>
<div class="first">
<img src="https://i.ibb.co/YQ09v1N/Eco.webp" alt="Eco" style="max-width: 350px">
<div class="first-text">
<p>PAISLEY PATTERN</p>
</div>
<div class="first2-text">
<p>Embrace bohemian style.</p>
</div>
</div>
<div class="second-text">
<p>ECO</p>
<p>POSITIVITY</p>
<p>COLLECTION</p>
</div>
<div class="second2-text">
<p>Make a difference,</p>
<p>be the change.</p>
</div>
<div class="second">
<img src="https://i.ibb.co/4tVLfzn/paisley.webp" alt="Paisley" style="max-width: 270px;">
</div>
<div class="third">
<img src="https://i.ibb.co/CVw2t2R/Spring-HUes.webp" alt="SpringHues" style="max-width: 310px;">
</div>
<div class="third-text">
<p>SPRING HUES</p>
</div>
<div class="third2-text">
<p>Colours That Celebrate</p>
<p>Spring.</p>
</div>
<div class="see-more">
SEE MORE
</div>
<div class="background-rect"></div>
</td>
</tr>
<!-- SOCIAL MEDIA ICONS -->
<div>
<td class="container2">
<div class="background2"></div>
<div class="icons">
<img src="https://i.ibb.co/bQgqb1L/icons.png" alt="">
</div>
</td>
</div>
<!-- BROWN BORDER -->
</table>
</center>
</body>
</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>
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="" >.