I am having trouble with the action of my DIVS. Basically I have a div and outside of the div if I put some html text it still shows up inside the div. I am not sure what I am doing wrong. If someone could take a peek I would greatly appreciate it. Thanks in advance.
html:
<div id="content">
<p> To submit <?php echo $_SESSION['sight_type']?> sightings, choose a location type.</p>
<div id = "form_location_type" >`
<form method="POST" action="location_type_input.php">
<table>
<tr>
<td><input type="radio" name="location_type" value="new" /></td><td><p> New location</p></td></tr>
<tr>
<td><input type="radio" name="location_type" value="saved" /></td><td><p> Saved location</p></td>
<td><input type="submit" value="Continue"></td></tr>
<table>
</form>
</div> <!-- End form_location_type div -->
THIS SHOULD BE OUTSIDE ABOVE DIV BUT IT PRINTS INSIDE
</div> <!-- End content div -->
<div id="footer"> <?php include 'footer.php'; ?> </div> <!-- End footer div -->
css (most relevant is the very last commented section)
html { height: 100%; }
body, html { min-height: 100%; height: 100%;margin : 0;
padding : 0; }
/*html, body {
height:auto
height: 100%; }/* Required */
body {
width:100%;
line-height : 1.8em;
color : #000000;
background : #F5F5FF;
}
#container {
position: relative;
min-height: 100%;
width : 800px;
margin : 0 auto 0 auto;
border-style: solid;
border-width:1px;
background : #FFFFCC;
-moz-box-shadow: 10px 10px 5px #888888; /* shadow border */
box-shadow: 10px 10px 5px #888888;
}
#footer {
clear:both;
position:absolute;
text-align: center;
left:0;
bottom: 0;
width: 800px;
background : #FFFFCC;
font : 75% "Trebuchet MS", verdana, arial, tahoma, sans-serif;
}
/* form on form_location_type.php */
#form_location_type {
margin: 0 auto;
background:white;
border:solid 1px;
}
Make sure you close your table properly:
<table>
...
</table>
That seems to be the problem: http://jsfiddle.net/RDGuY/2/
You have not closed table properly.
Add
</table>
instead of the
<table>
at the end of form_location_type div
Additionally try to add some bottom padding in form_location_type div:
Add the following code in your CSS:
#form_location_type {
padding-bottom: 2em;
}
Now check if the text is separated from form div???
Related
I'm creating PDFs in ColdFusion using cfdocument. I need to make a table with the header row slanted so it all fits on the page. Here's an example of what I'm trying to accomplish. None of the HTML or CSS examples I have found so far have worked. Now I'm wondering if this is a quirk specific to ColdFusion and/or PDFs creation. I know this code came directly from an answer to a similar question here, but it does not create a table with slanted columns in my PDF.
It creates this.
//CSS
* {
box-sixing: border-box;
}
.outerDiv {
background: grey;
height: 200px;
width: 100px;
border: 1px solid black;
border-bottom: 0;
border-left: 0;
transform: skew(-30deg) translateX(58%);
}
th:first-child .outerDiv {
border-left: 1px solid black;
position: relative;
}
.innerDiv {
position: absolute;
width: 250px;
height: 85px;
bottom: -34%;
left: 10px;
transform: skew(30deg) rotate(-60deg);
transform-origin: 0 0;
text-align: left;
}
body,
html {
height: 100%;
}
body {
display: flex;
justify-content: center;
}
table {
border-collapse: collapse;
}
td {
border: 1px solid black;
}
.well {
min-height: 20px;
padding: 5px;
margin-bottom: 10px;
background-color: #f5f5f5;
border: 1px solid black;
border-radius: 3px;
}
.well_tight {
padding: 3px;
margin-bottom: 5px;
background-color: #f5f5f5;
border: 1px solid black;
border-radius: 3px;
}
//ColdFusion/HTML
<cfdocument format="pdf" name="#formname#" pagetype="letter" marginleft=".25" marginright=".25" margintop=".25" marginbottom=".5">
<cfoutput><style type="text/css">#import "/mach15/web/assets/css/formPDF.css";</style></cfoutput>
<div class="well">
<table cellpadding="0" cellspacing="0">
<tr>
<th>
<div class="outerDiv">
<div class="innerDiv">This is first column header</div>
</div>
</th>
<th>
<div class="outerDiv">
<div class="innerDiv">This is second column header</div>
</div>
</th>
<th>
<div class="outerDiv">
<div class="innerDiv">This is third column header</div>
</div>
</th>
</tr>
<tr>
<td> 1 </td>
<td> 2 </td>
<td> 3 </td>
</tr>
<tr>
<td> 4 </td>
<td> 5 </td>
<td> 6 </td>
</tr>
<tr>
<td> 7 </td>
<td> 8 </td>
<td> 9 </td>
</tr>
<tr>
<td> 10 </td>
<td> 11 </td>
<td> 12 </td>
</tr>
</table>
</div>
I work on styling PDF documents using cfdoucment quite a bit and have had a lot of trouble with CSS. so many features aren't supported that would make styling the PDFs so much easier: CSS3 properties, CSS Pseudo elements and not even the !important tag can be used unfortunately.
There are however enough tricks and work arounds that you can use to (somewhat) achieve your desired results, they usually require customizing your markup a bit, Here's how I would go about solving your problem:
First: Getting a table with bordered cells/rows is not a fun task with CSS for CF PDF. One of the CSS Properties that's not supported is border-collapse: collapse; so if you use tables there will be spaces between cells, etc.. you'll end up with something like this for a standard table:
So I would probably generate a separate markup using <div> just for your PDF content and add a pdf-only class or something to it to display only on PDFs and hide elsewhere.
In your questions there are 2 problems that cannot be fixed due to CSS's limitation. 1) slanted lines 2) vertical slanted text.
1) Slanted lines:
I was able to create the slanted blocks by attaching a background image (see below) to the header cells and shifting them along with some other css code that's hopefully easy to follow:
.th {
padding:10px 0;
height: 200px;
position: relative;
left:50px;
border-top: 1px solid #000;
background:url(../img/line.gif) no-repeat right center;
}
Here's the full markup with the CSS:
<div class="table-wrapper pdf-only">
<div class="row th-row">
<div class="th th1"> </div>
<div class="th th2"> </div>
<div class="th th3"> </div>
<div class="th th4"> </div>
</div>
<div class="row td-row first-td-row">
<div class="td td1">Row 1</div>
<div class="td td2"><span class="td-border"></span>r1c1</div>
<div class="td td3"><span class="td-border"></span>r1c2</div>
<div class="td td4"><span class="td-border"></span>r1c3<span class="td-last-border"></span></div>
</div>
<div class="row td-row">
<div class="td td1">Row 2</div>
<div class="td td2">r2c1</div>
<div class="td td3">r2c2</div>
<div class="td td4">r2c3</div>
</div>
</div>
CSS:
.table-wrapper {
width:75%; // so that the last column won't get cut off
position: relative;
}
.row {
width: 100%;
}
.td-row {
border-bottom:1px solid #000;
width: 100%;
position: relative;
}
.td {
padding:15px 0;
text-indent: 10px;
position: relative;
}
.th {
padding:10px 0;
height: 200px;
position: relative;
left:50px; // this should the same as the width of line.gif
border-top: 1px solid #000;
background:url(../img/line.gif) no-repeat right center;
}
/* Adjust the td, th widths below . You can even add different % to
different cols as long as the total adds up to 100% per row. */
.td, .th {
width: 25%;
float: left;
}
.th1 {
border-top: 0;
}
span.td-border {
height:1000px;
width: 1px;
position: absolute;
border-left: 1px solid #000;
left: 0;
top:0;
}
span.td-last-border {
height:1000px;
width: 1px;
position: absolute;
border-left: 1px solid #000;
right: -10px;
top:0;
}
.first-td-row {
border-bottom: 1px solid #000
}
Here's what you'll get: (this is an actual generated PDF using <cfdocument>)
so that takes care of the slanted headers
2) Vertical Text
I can think of 2 solutions, none of which are ideal, but then again we're styling CF PDFs so we'll have to get creative.
To get exactly what you have posted in your question (rotated text) I believe the only way to achieve this is using images instead of texts. Yeah I know it's cheating specially if your tables are going to be dynamic with the header texts constantly changing this won't work. But if this list won't change too much you might as well use images, example:
You would then add another element inside your header cell and set that image as its background and center position it:
<div class="th th1">
<div class="text"></div>
</div>
.th .text {
width:100%;
height:100%;
position:absolute;
}
.th1 .text {
background-image:url(../img/col1-text.gif) no-repeat center center;
}
If using images as texts won't work, you can perhaps loop through the text and and a line break after each letter followed by a space and increment it each time in a descending fashion:
1<br/>
l<br/>
o<br/>
C<br/>
That obviously doesn't rotate the text, but it will make it easier to fit the content in the header.
Hope that helps.
Are you using CF11 or above? If so, please use <cfhtmltopdf> with much better css support instead of the legacy <cfdocument>.
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-g-h/cfhtmltopdf.html
I want to make my textarea like as facebook. Where in same line display a textarea, a upload icon and a emoticons icon.
Now, I want my textarea will be responsible width And 2 icon will be fixed 25px width.
Here is in my example fiddle textarea overflow my 2 icon But I want they will not be overflow.
How can it possible without CSS media query and div contenteditable?
Your markup and style could be simplified
Fork: http://jsfiddle.net/s0e5ks6n/3/
CSS
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.maintbox {
position:relative;
width: 100%;
}
#frm textarea{
min-height: 25px;
border: 2px solid #ccc;
width:100%;
resize: none;
margin: 0;
padding-right:60px;
}
#right {
position:absolute;
top: 0px;
right:0px;
height: 35px;
line-height: 35px;
width: 60px;
z-index:1;
}
#right img {
cursor:pointer;
vertical-align: middle;
}
Markup
<form action="" id="frm">
<textarea placeholder="Type here..."> </textarea>
<div id="right">
<img src="https://cdn3....png" alt="" />
<img src="http://s...png" />
</div>
</form>
Final result
I am using the following lay-out: http://peterned.home.xs4all.nl/examples/csslayout1.html
Right now, I'm trying to create something like this: http://imgur.com/P64BojY
What I would like to have is a header, two divs in the middle of the page and a fixed footer. All of the divs (except for the footer) should be of the same size.
Basically, what I'm trying to do is to divide the central div (from the lay-out I've mentioned before) into two divs of the same size, I need the footer to stay at the bottom of the page though.
For my other pages I'll need to be using the same lay-out, except for the bottom div, which has to be divided in 3 divs, like this: http://imgur.com/XuxxlAE
I'm not sure how to do any of this, since I'm working with the min-height 100%...
So yeah... any help would be appreciated! Thanks
is this what you want? easier to just show you a jsfiddle so you check the css needed.
<div class="container">
<div class="containerDivs">
<div class="div1">
div1
</div>
<div class="div2">
div2
</div>
</div>
<div class="footer">
footer
</div>
</div>
http://jsfiddle.net/QcG7a/
Try this solution, I have replaced div content with two divs with class content
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Documento senza titolo</title>
<style>
html, body {
background: none repeat scroll 0 0 #808080;
color: #666666;
font-family: arial,sans-serif;
font-size: small;
height: 100%;
margin: 0;
padding: 0;
}
h1 {
font: 1.5em georgia,serif;
margin: 0.5em 0;
}
h2 {
font: 1.25em georgia,serif;
margin: 0 0 0.5em;
}
h1, h2, a {
color: #FFA500;
}
p {
line-height: 1.5;
margin: 0 0 1em;
}
div#container {
background: none repeat scroll 0 0 #F0F0F0;
height: auto !important;
margin: 0 auto;
min-height: 100%;
position: relative;
width: 750px;
}
div#header {
background: url("../csslayout.gif") no-repeat scroll 98% 10px #DDDDDD;
border-bottom: 6px double #808080;
padding: 1em;
}
div#header p {
font-size: 1.1em;
font-style: italic;
margin: 0;
}
#a{padding: 1em 1em 0em 1em;}
#b{padding: 0em 1em 6em 1em;}
div#content p {
padding: 0 1em;
text-align: justify;
}
div#footer {
background: none repeat scroll 0 0 #DDDDDD;
border-top: 6px double #808080;
bottom: 0;
position:absolute;
width: 100%;
}
div#footer p {
margin: 0;
padding: 1em;
}
</style>
</head>
<body>
<div id="container">
<div id="header">
<h1>CSS layout: 100% height with header and footer</h1>
<p>Sometimes things that used to be really simple with tables can still appear pretty hard with CSS. This layout for instance would consist of 3 cells; two with a fixed height, and a third one in the center filling up the remaining space. Using CSS, however, you have to take a different approach.</p>
</div>
<!--div content duplicated-->
<div class="content" id="a">
<h2>Min-height</h2>
<p>Lorem ipsum...</p>
</div>
<div class="content" id="b">
<h2>Min-height</h2>
<p>Lorem ipsum...</p>
</div>
<div id="footer">
<p>
This footer is absolutely positioned to bottom:0; of #container. The padding-bottom of #content keeps me from overlapping it when the page is longer than the viewport.
</p>
</div>
</div>
</body>
</html>
I have a while loop that echos out several images. My next step is to have text over the image. However, as soon as I add that text to the while loop my images go from inline to block. I've tried just about everything from changing the display to inline and playing with the different positions with the images and text. How do I fix this. Code below.
Script Section
<script type="text/javascript" >
$(function() {
$("h2")
.wrapInner("<span>")
$("h2 br")
.before("<span class='spacer'>")
.after("<span class='spacer'>");
});
</script>
Style Section
<style type="text/css">
body {height: 1100px;}
html {height:1200px; }
h2 {
top: 200px;
left: 25px;
width: 100px;
position: relative;
}
div #image_box {width: 700px; display:inline;}
img {border: 1px solid grey; padding: 0; margin:15px; display:inline;}
#viewers_pleasure { padding: 15px; height: 1200px; width: 4800px; }
h2 span {
color: white;
font: bold 24px/45px Helvetica, Sans-Serif;
letter-spacing: -1px;
background: rgb(0, 0, 0); /* fallback color */
background: rgba(0, 0, 0, 0.7);
padding: 10px;
}
h2 span.spacer {
padding:0 5px;
}
</style>
Body Section
<div id="viewers_pleasure">
<div id="image_box">
<img src="images/89c246298be2b6113fb10ba80f3c6956_8" width="560" height="420"/>
<h2><br>$</h2>
</div>
<div id="image_box">
<img src="images/8e73b27568cb3be29e2da74d42eab6dd_9" width="560" height="420"/>
<h2><br>$</h2>
</div>
<div id="image_box">
<img src="images/216e77337cdef3bd1bede845d1aba608_3" width="560" height="420"/>
<h2>weezer<br>$0</h2>
</div>
<div id="image_box">
<img src="images/452ff601eb791947cd76a2119f1db973_2" width="560" height="420"/>
<h2><br>$</h2>
</div>
</div>
Try using float left for image_box
div #image_box {width: 700px; display:inline; float:left }
I believe the problem is that the <h2> tags are display:block by default. Try removing them from the flow and see if fixes the image display issue.
I am trying to float the timer right top across from the logo. but it's not working.
If I use the regular style="float:right" it works perfect...
<div id="whole_page" />
<div id="header" />
<?php echo "$logo" ?>
<div id="timer" style="float:right" /><?php
echo "$today";
?></div>
</div>
<div id="nav" />
Home |
About |
Help
</div>
<div id="content" />
<?php
echo "Hello, my name is, $first_name \"$nick_name\" $last_name<br />";
echo "I am from $city, $country<br />";
?>
</div>
</div>
This is the css:
#whole_page {
width: 65em;
margin: auto;
padding: 0;
text-align: left;
border-width: 0 1px 1px;
border-color: #000;
border-styler: solid;
}
#header {
color: white;
background: #ebebeb;
font-size: 24pt;
margin-bottom: 0;
font-weight: bold;
}
#timer {
float: right;
margin-bottom: 0;
}
#nav {
color: #000;
font-size: 12pt;
font-weight: none;
background: #ebebeb;
padding: 0.5em;
border: none;
Usually, for a float to work, you need to set a width on the element.
(Otherwise, the browser renders the element at 100% and there is nothing to float.)
So make this
#timer{
width:200px; //OR WHATEVER SIZE
float:right;
margin-bottom:0;
}
What happens when you use F12 debug? Do you see any style applied to the element? Also view the source code of of rendered page and see the actual CSS in the page. Then please post the necessary css from there to debug it.
Try to add to div header:
float:left;
If you want that a div to be in the next line just place:
clear: both;