How to adjust the div as below image? - php

I want adjust my div like this,
<------------------header--------------------->
========================================================
tree structure table div
==
== =
== ===========================================
== = graph div = drop down div
==
== =
=
=========================================================
footer
My code is,
<?php
include("Config.php");
if(isset($_POST['submit'])){
if(!empty($_POST['check_list'])) {
echo"<div style=\"width: 100%; height:7%; background-color: green; color: white; id=header;\">";
echo"</div>";
echo"<div style=\"width:20%; height:86%;color: white; background-color:pink;class=page-container;\">";
<---------some codes---------------->
echo"</div>";//tree div ends
echo"<div style=\"width:80%; height:38%; background-color: skyblue; color:white;float:left;\">
right div1";echo"</div>";
echo"<div style=\"width: 20%; height:50%; background-color: lightblue; color:white;float:left;\">
right div2";echo"</div>";
echo"<div style=\"width:300px; height:53%; background-color:orange; color: white; float:left;\">
right div3";echo"</div>";
echo"<div style=\"width: 1600px; height:5%; background-color: green; color: white; float:left; left;\">
footer div";echo"</div>";
}//inside if ends
?>
can any one help me I am struggling a lot to do this.

a simple solution with flex with the use of external CSS as your shouldn't write all the styles as inline.
I used only HTML in order to show the result but i think you can easily echo it wth PHP later.
body {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
height: 100vh;
}
header,
footer {
min-height: 50px;
background: green;
}
.container {
flex: 1;
display: flex;
}
.sidebar {
flex: 1;
background: red;
}
.left {
flex: 2;
background: pink;
display: flex;
flex-direction: column;
}
.top,
.bottom {
flex: 1;
background: blue;
}
.bottom {
display: flex;
}
.bottom>div {
flex: 1;
background: linear-gradient(to right, yellow, black);
}
<header></header>
<div class="container">
<div class="sidebar"></div>
<div class="left">
<div class="top">
</div>
<div class="bottom">
<div></div>
<div></div>
</div>
</div>
</div>
<footer></footer>

Using flexbox you could do it like this. However, I would recommend splitting out the CSS from the PHP file.
<?php
include("Config.php");
if(isset($_POST['submit'])){
if(!empty($_POST['check_list'])) {
echo '<style type="text/css">
body {
margin: 0;
}
.header, .footer {
width: 100%;
height: 3rem;
background: green;
}
.content-wrapper {
height: calc(100vh - 6rem);
display: flex;
flex-wrap: nowrap;
flex-direction: row;
justify-content: space-evenly;
}
.left-col {
width: 20%;
background: pink;
height: 100%;
}
.right-col {
width: 80%;
height: 100%;
display: flex;
flex-wrap: wrap;
}
.cell {
background: #ccc;
}
.dark-blue {
width: 100%;
flex-grow: 1;
background: steelblue;
}
.light-blue {
width: 70%;
background: aqua;
}
.orange {
width: 30%;
background: orange;
}
</style>';
echo '<div class="header">Header</div>
<div class="content-wrapper">
<div class="left-col">Pink</div>
<div class="right-col">
<div class="cell dark-blue">Dark blue</div>
<div class="cell light-blue">Light blue</div>
<div class="cell orange">Orange</div>
</div>
</div>
<div class="footer">Footer</div>';
}
}
?>

Related

How do I make my embedded pdf file to be full screen on my website?

This is what I've got but this doesn't solve the problem for different devices and screen sizes.
<html>
<body>
<iframe src="FILE LINK" width="1920" height="1080"></iframe>
</body>
</html>
How do I make it full screen? I've tried width: 100%; height: 100%
For reaching fullscreen in this case you need to use height: 100vh;, width: 100%;
body {
margin: 0;
}
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
.landing {
width: 100%;
height: 100vh;
}
.image-list {
margin: 0;
padding: 0;
list-style: none;
width: 100%;
height: 100vh;
border: 6px solid #00f;
overflow: hidden;
}
.image-list .image {
border: 6px solid #f00;
width: 100%;
height: 400px;
background-size: cover;
background-position: center center;
height: 100vh;
}
.centered-element {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
background: #fff;
padding: 1rem;
width: 280px;
}
.centered-element ul {
margin: 0;
padding: 0;
list-style: none;
}
.centered-element ul span {
opacity: 0.4;
}
<!-- body -->
<section class='landing'>
<ul class='image-list'>
<li class='image'
style='background-image: url(https://unsplash.it/1600/1600)'>
</li>
<li class='image'
style='background-image: url(https://unsplash.it/1600/1800)'>
</li>
<li class='image'
style='background-image: url(https://unsplash.it/1600/1700)'>
</li>
</ul>
</section>
<!-- /body -->
Well, a simple snippet like the following one did the trick for me:
body {
height: 100%;
width: 100%;
margin: 0;
padding: 5px;
box-sizing: border-box;
}
html {
height: 100%;
}
<iframe src="#" width="100%" height="100%"></iframe>
Just play with the containers.
You should of course set your own container sizes to 100% and not html and body.

Need to make photos appear in random order but maintain side by side responsiveness.

So I wrote a code to make 4 photos (or more) be responsive (Pinboard like) but I can't figure out how to make the photos be random.
Example: You visit the page and you see img A: B: C :D Then when you refresh the page there is a different set of images. I know there is plenty of tutorials to randomize photos but I haven't found anything with the pinboard like design that I created.
Could really use some help in understanding what code I need to add to make the photos change with each page refresh instead of always showing the same photos.
HERES MY CODE:
<!DOCTYPE html>
<html>
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: Arial;
}
.header {
text-align: center;
padding: 32px;
}
.row {
display: -ms-flexbox; /* IE10 */
display: flex;
-ms-flex-wrap: wrap; /* IE10 */
flex-wrap: wrap;
padding: 0 4px;
}
/* Create four equal columns that sits next to each other */
.column {
-ms-flex: 25%; /* IE10 */
flex: 25%;
max-width: 25%;
padding: 0 4px;
}
.column img {
margin-top: 8px;
vertical-align: middle;
}
/* RL - makes a two column-layout instead of four columns */
#media screen and (max-width: 800px) {
.column {
-ms-flex: 50%;
flex: 50%;
max-width: 50%;
}
}
/* Responsive layout - makes the two columns stack on top of each other
instead of next to each other */
#media screen and (max-width: 600px) {
.column {
-ms-flex: 100%;
flex: 100%;
max-width: 100%;
}
}
</style>
<body>
<!-- Header -->
<div class="header">
<h1>Responsive Image Grid</h1>
<p>Testing system.</p>
</div>
<!-- Photo Grid -->
<div class="row">
<div class="column">
<img src="/public/admin/haleyfoxforabout333.jpg" style="width:100%">
</div>
<div class="column">
<img src="/public/user/2c/04/d72477bc8b54505d2027a5966f941252.jpg"
style="width:100%">
</div>
<div class="column">
<img src="/public/album_photo/3b/04/0196544bb5fdd97b9a40e49327394756.jpg"
style="width:100%">
</div>
<div class="column">
<img src="/public/user/ca/03/8a344be65723d3d001f1b34acb5f6742.jpg"
style="width:100%">
</div>
</body>
</html>
NEW CODE after a suggestion from someone. (Still not working give an error.)
<br>
<br>
<h50><?php echo $this->translate('Be Discovered!'); ?></h50>
and connected. Meet anyone & see everything!</a></p>
<br>
<?php
$pics = [
"/public/admin/haleyfoxforabout333.jpg",
"/public/user/2c/04/d72477bc8b54505d2027a5966f941252.jpg",
"/public/user/ca/03/8a344be65723d3d001f1b34acb5f6742.jpg",
"/public/album_photo/3b/04/0196544bb5fdd97b9a40e49327394756.jpg"
];
shuffle($pics);
?>
<style>
h50 {
padding: 0 30px 8px;
width: auto;
font-size: 40px;
margin: 0 0 10px 0;
background-color: transparent;
border: none;
border-bottom: 1px solid #D2DBE8;
border-radius: 3px 3px 0 0;
display: inline-block;
}
.headerz {
text-align: center;
padding: 32px;
}
.rowz {
display: -ms-flexbox; /* IE10 */
display: flex;
-ms-flex-wrap: wrap; /* IE10 */
flex-wrap: wrap;
padding: 0 4px;
}
/* Create four equal columns that sits next to each other */
.columnz {
-ms-flex: 25%; /* IE10 */
flex: 25%;
max-width: 25%;
padding: 0 4px;
}
.columnz img {
margin-top: 8px;
vertical-align: middle;
}
/* RL - makes a two column-layout instead of four columns */
#media screen and (max-width: 800px) {
.columnz {
-ms-flex: 50%;
flex: 50%;
max-width: 50%;
}
}
/* RL Takes the two columns stack on top of each other. */
#media screen and (max-width: 600px) {
.columnz {
-ms-flex: 100%;
flex: 100%;
max-width: 100%;
}
}
</style>
<!-- Photo Grid -->
<div class="rowz">
<?php
foreach($pics as $pic){
echo '<div class="column">';
echo '<img src="'..'" style="width:100%">';
echo '</div>';
}
?>
<?php
foreach($pics as $pic){
echo '<div class="column">';
echo '<img src="'..'" style="width:100%">';
echo '</div>';
}
?>
<?php
foreach($pics as $pic){
echo '<div class="column">';
echo '<img src="'..'" style="width:100%">';
echo '</div>';
}
?>
<?php
foreach($pics as $pic){
echo '<div class="column">';
echo '<img src="'..'" style="width:100%">';
echo '</div>';
}
?>
</div>
The shuffle() function randomizes the order of the elements in the array.
This function assigns new keys for the elements in the array. Existing keys will be removed
....
<?php
$pics = [
"/public/admin/haleyfoxforabout333.jpg",
"/public/user/2c/04/d72477bc8b54505d2027a5966f941252.jpg",
"/public/user/ca/03/8a344be65723d3d001f1b34acb5f6742.jpg",
"/public/album_photo/3b/04/0196544bb5fdd97b9a40e49327394756.jpg"
];
shuffle($pics);
?>
<body>
<!-- Header -->
<div class="header">
<h1>Responsive Image Grid</h1>
<p>Testing system.</p>
</div>
<!-- Photo Grid -->
<div class="row">
<?php
foreach($pics as $pic){
echo '<div class="column">';
echo '<img src="'..'" style="width:100%">';
echo '</div>';
}
?>
</div>
</body>
.
FULL CODE:
HERES MY CODE:
<!DOCTYPE html>
<html>
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: Arial;
}
.header {
text-align: center;
padding: 32px;
}
.row {
display: -ms-flexbox; /* IE10 */
display: flex;
-ms-flex-wrap: wrap; /* IE10 */
flex-wrap: wrap;
padding: 0 4px;
}
/* Create four equal columns that sits next to each other */
.column {
-ms-flex: 25%; /* IE10 */
flex: 25%;
max-width: 25%;
padding: 0 4px;
}
.column img {
margin-top: 8px;
vertical-align: middle;
}
/* RL - makes a two column-layout instead of four columns */
#media screen and (max-width: 800px) {
.column {
-ms-flex: 50%;
flex: 50%;
max-width: 50%;
}
}
/* Responsive layout - makes the two columns stack on top of each other
instead of next to each other */
#media screen and (max-width: 600px) {
.column {
-ms-flex: 100%;
flex: 100%;
max-width: 100%;
}
}
</style>
<body>
<!-- Header -->
<div class="header">
<h1>Responsive Image Grid</h1>
<p>Testing system.</p>
</div>
<!-- Photo Grid -->
<div class="row">
<div class="column">
<img src="/public/admin/haleyfoxforabout333.jpg" style="width:100%">
</div>
<div class="column">
<img src="/public/user/2c/04/d72477bc8b54505d2027a5966f941252.jpg"
style="width:100%">
</div>
<div class="column">
<img src="/public/album_photo/3b/04/0196544bb5fdd97b9a40e49327394756.jpg"
style="width:100%">
</div>
<div class="column">
<img src="/public/user/ca/03/8a344be65723d3d001f1b34acb5f6742.jpg"
style="width:100%">
</div>
</body>
</html>
NEW CODE after a suggestion from someone. (Still not working give an error.)
<br>
<br>
<h50><?php echo $this->translate('Be Discovered!'); ?></h50>
and connected. Meet anyone & see everything!</a></p>
<br>
<?php
$pics = [
"/public/admin/haleyfoxforabout333.jpg",
"/public/user/2c/04/d72477bc8b54505d2027a5966f941252.jpg",
"/public/user/ca/03/8a344be65723d3d001f1b34acb5f6742.jpg",
"/public/album_photo/3b/04/0196544bb5fdd97b9a40e49327394756.jpg"
];
shuffle($pics);
?>
<style>
h50 {
padding: 0 30px 8px;
width: auto;
font-size: 40px;
margin: 0 0 10px 0;
background-color: transparent;
border: none;
border-bottom: 1px solid #D2DBE8;
border-radius: 3px 3px 0 0;
display: inline-block;
}
.headerz {
text-align: center;
padding: 32px;
}
.rowz {
display: -ms-flexbox; /* IE10 */
display: flex;
-ms-flex-wrap: wrap; /* IE10 */
flex-wrap: wrap;
padding: 0 4px;
}
/* Create four equal columns that sits next to each other */
.columnz {
-ms-flex: 25%; /* IE10 */
flex: 25%;
max-width: 25%;
padding: 0 4px;
}
.columnz img {
margin-top: 8px;
vertical-align: middle;
}
/* RL - makes a two column-layout instead of four columns */
#media screen and (max-width: 800px) {
.columnz {
-ms-flex: 50%;
flex: 50%;
max-width: 50%;
}
}
/* RL Takes the two columns stack on top of each other. */
#media screen and (max-width: 600px) {
.columnz {
-ms-flex: 100%;
flex: 100%;
max-width: 100%;
}
}
</style>
<!-- Photo Grid -->
<div class="rowz">
<?php
foreach($pics as $pic){
echo '<div class="column">';
echo '<img src="'.$pic.'" style="width:100%">';
echo '</div>';
}
?>
</div>

Footer overlapping only one page

The footer is overlapping one of my webpage. all the others pages are fine but this one its overlapping, i dont really want to edit/update the footer as it is working in other pages, but I would like to see if there is something I can do with the css container for this page.
CSS
#box {
width: 100%;
height: auto;
margin-top: 20px;
position:relative;
padding-right:0.4%;
float:left;
margin-bottom: 10px;
}
.boxChildLeft {
left: 0;
width: 80%;
height: 100px;
border: 1px solid;
margin-bottom: 2px;
position: relative;
float: left;
}
CSS footer/body etc
html,
body {
margin:0 auto;
padding: 0;
max-width: 960px;
height: 100%;
background-color: white;
}
#container {
min-height:100%;
position:relative;
}
#header {
background:white;
padding:10px;
}
#body {
padding:10px;
padding-bottom:40px; /* Height of the footer */
}
#footer {
position: absolute;
bottom:0;
left: 0;
right: 0;
height:40px; /* Height of the footer */
background:#EBEBEB;
border-radius: 5px;
}
PHP/HTML
for($temp = 1; $temp <= $cArray[2]; $temp++)
{
$img .= "<div class='boxChildLeft'>
<div class='img'>
<img src='../ProductImages/$cArray[0].jpg' width='100px' height='100px'>
</div>
<div class='prodInfo'>
<p1>$pName</p1><br>
<span id='sp'><p1>$pPrice<p1>
</span>
</div>
</div>";
}
HTML
<div id="box">
<?php echo $img;?>
</div>
The information you provided is not enough, what I suggest is to use W3school HTML validator it will indicate what's missing from your HTML implementation, it will help you by giving suggestions.

Why are the columns stacked up?

I am making a small shop and I have a page where I display my products. The code of this page looks like this:
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
if(isset($_GET['action']) && $_GET['action']=="add"){
$id=($_GET['id']);
if(isset($_SESSION['cart'][$id])){
$_SESSION['cart'][$id]['quantity']++;
}else{
$sql_s="SELECT * FROM products
WHERE productCode='{$id}'";
$query_s=mysql_query($sql_s) or die(mysql_error());
if(mysql_num_rows($query_s)!=0){
$row_s=mysql_fetch_array($query_s);
$_SESSION['cart'][$row_s['productCode']]=array(
"quantity" => 1,
"price" => $row_s['buyPrice']
);
}else{
$message="This product id it's invalid!";
}
}
}
?>
<h1>Classic Cars</h1>
<?php
if(isset($message)){
echo "<h2>$message</h2>";
}
?>
<div class="container">
<?php
$sql="SELECT * FROM products ORDER BY productName ASC";
$query=mysql_query($sql) or die(mysql_error());
while ($row=mysql_fetch_array($query)) {
?>
<div class="row">
<div class="col-xs-12 col-sm-4 col-md-3">
<div class="recent-work-wrap">
<img class="img-responsive" src="images/portfolio/recent/item1.png" alt="">
<div class="overlay">
<div class="recent-work-inner">
<h3><?php echo $row['productName'] ?> </h3>
<p>€<?php echo $row['buyPrice'] ?></p>
<a class="btn btn-login" href="register.php">Add to cart</i></a>
<a class="btn btn-login" href="register.php">Read more</i></a>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
Never mind the pictures, they are all the same at the moment.
The css of this part is as follows:
#recent-works .col-xs-12.col-sm-4.col-md-3{
padding: 0;
}
.recent-work-wrap {
position: relative;
}
.recent-work-wrap img{
width: 100%;
}
.recent-work-wrap .recent-work-inner{
top: 0;
background: transparent;
opacity: .8;
width: 100%;
border-radius: 0;
margin-bottom: 0;
}
.recent-work-wrap .recent-work-inner h3{
margin: 10px 0;
}
.recent-work-wrap .recent-work-inner h3 a{
font-size: 24px;
color: #fff;
}
.recent-work-wrap .overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
border-radius: 0;
background: #BDBDBD;
color: #fff;
vertical-align: middle;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
padding: 30px;
}
.recent-work-wrap .overlay .preview {
bottom: 0;
display: inline-block;
height: 35px;
line-height: 35px;
border-radius: 0;
background: transparent;
text-align: center;
color: #fff;
}
.recent-work-wrap:hover .overlay {
opacity: 1;
}
The result of the code looks like this:
Why are the columns stacked up? And how can I solve this?
HTML:
<img class="img-responsive inline-block" src="images/portfolio/recent/item1.png" alt="">
Add the below markup to your CSS:
.inline-block{ display: inline-block;}
You can try this CSS property to image:
img{
display: inline-block;
float:left;
}

One set of dynamically generated controls for two sliding lists (jQuery)

I am using the Easy Slider plugin (http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding) to scroll several lists. The plugin dynamically generates the controls for the lists. So there are two sets of controls showing up. I was wondering if I could bind the controls into a single set. I would like the single controls to slide/scroll both lists at the same time. The reason I am doing this I have 100% width background that I want to scroll the same time as a "feature" div inside my wrapper. The layout/css is working great - just need a hand with the js.
FUNCTION
<script>
$(document).ready(function(){
$("#slides, #slideTop").easySlider({
auto: true,
continuous: true,
numeric: true
});
});
</script>
HTML
<div id="slides">
<ul>
<li class="slideOne"></li>
<li class="slideTwo"></li>
<li class="slideThree"></li>
</ul>
</div>
<div class="container_16">
<div class="grid_16">
<div id="slideTop">
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
</div>
CSS
#slideTop{
width:940px;
height: 350px;
background-color: #ccc;
position: absolute;
z-index: 9999;
overflow: hidden;
}
#slides{
width:100%;
height: 350px;
background-color: blue;
margin: 0 auto;
position: absolute;
top:144px;
z-index: -9999;
overflow: hidden;
}
#slideTop ul {
padding:0;
width: 940px;
height: 350px;
}
#slideTop ul li {
height:350px;
list-style:none;
width: 940px;
}
#slides ul {
margin: 0 auto;
padding:0;
width: 100%;
height: 350px;
}
#slides ul li {
margin:0;
padding:0;
height:350px;
list-style:none;
width:4000px;
float: left;
}
.slideOne {
background: url(images/one.gif) repeat-x;
width: 100%;
height: 350px;
}
.slideTwo {
background: url(images/two.gif) repeat-x;
width: 100%;
height: 350px;
}
.slideThree {
background: url(images/three.gif) repeat-x;
width: 100%;
height: 350px;
}
ul#controls {
height:21px;
padding:0;
width:100px;
position:absolute;
z-index:500;
top:620px;
float:left;
margin-left:430px
}
ul#controls li {
float:left;
height:21px;
list-style-type:none;
margin:0;
padding:0 3px;
width:21px
}
ul#controls li a {
background:url(images/ss.png) no-repeat 0 0;
display:block;
float:left;
height:21px;
width:21px;
border:none
}

Categories