Text flows out of containing Div [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have a forum system in php, but when the posts come out, if they're long, they end up like this,
html,
body {
height:100%;
width:100%;
background: url(/include/images/dirt.png);
}
.center-container {
margin-top:15px;
margin-right:15%;
margin-left: 15%;
box-shadow: 0 1px 10px #a7a7a7, 0 1px 0 #fff;
padding:0.5em;
}
.button {
border-top: 1px solid #002136;
background: #033e66;
background: -webkit-gradient(linear, left top, left bottom, from(#031826), to(#033e66));
background: -webkit-linear-gradient(top, #031826, #033e66);
background: -moz-linear-gradient(top, #031826, #033e66);
background: -ms-linear-gradient(top, #031826, #033e66);
background: -o-linear-gradient(top, #031826, #033e66);
padding: 5px 10px;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
-webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
-moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
box-shadow: rgba(0,0,0,1) 0 1px 0;
text-shadow: rgba(0,0,0,.4) 0 1px 0;
color: white;
font-size: 14px;
font-family: Georgia, serif;
text-decoration: none;
vertical-align: middle;
padding-bottom:3px;
margin-right:5px;
}
.button:hover {
border-top-color: #28597a;
background: #28597a;
color: #ccc;
}
.button:active {
border-top-color: #1b435e;
background: #1b435e;
}
.sidebar1 {
margin-top:15px;
float:left;
width:13%;
display:inline-block;
box-shadow: 0 1px 10px #a7a7a7, 0 1px 0 #fff;
}
.sbutton {
border-top: 1px solid #002136;
background: #033e66;
background: -webkit-gradient(linear, left top, left bottom, from(#031826), to(#033e66));
background: -webkit-linear-gradient(top, #031826, #033e66);
background: -moz-linear-gradient(top, #031826, #033e66);
background: -ms-linear-gradient(top, #031826, #033e66);
background: -o-linear-gradient(top, #031826, #033e66);
padding: 5px 10px;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
-webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
-moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
box-shadow: rgba(0,0,0,1) 0 1px 0;
text-shadow: rgba(0,0,0,.4) 0 1px 0;
color: white;
font-size: 14px;
font-family: Georgia, serif;
text-decoration: none;
vertical-align: middle;
padding-bottom:3px;
display:block;
}
.sbutton:hover {
border-top-color: #28597a;
background: #28597a;
color: #ccc;
}
.sbutton:active {
border-top-color: #1b435e;
background: #1b435e;
}
is there a CSS rule that I can use to make that wrap to the next line?
EDIT: SOLVED! This actually seems to be a problem with Firefox. Not sure why, but if width is set in firefox, even if it is max-width, it will overflow the box for some reason

You can use the CSS3 text-wrap Property:
http://www.w3schools.com/cssref/css3_pr_text-wrap.asp
p.test {text-wrap:unrestricted;}

Your link doesn't work so I'm guessing here.
Most likely your div expands outside of the width of the screen, meaning that the content will to.
You could try to set the max-width property of your div to something like 80% (or less) and wrap any text in p-tags.
To be absolutely sure, combine that with superUntitled's answer and set:
p.test {word-wrap:break-word; }
EDIT
I tried your example and it works for me in this JsFiddle example
Try a css reset like this

yes, the CSS3 word-wrap in combination with the hyphen property
p.test {
word-wrap:break-word;
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
http://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/

Related

Page has boxed look after applying Bootstrap in Laravel

I have two divs on this page, the second div has an iframe in it. It looks, works, feels fine, however, after applying bootstrap css and js, the whole page gets a wrapped look, and everything is stuffed into the middle (see pics attached.) Maybe my other css file has something to do with it?
My css:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html,body,.container {
height:100%;
}
body {
margin: 0;
background: #f7f7f7;
color: #363636;
font-family: 'Source Sans Pro', 'Helvetica', 'Arial', sans-serif;
font-size: 16px;
line-height: 1.42857143;
}
.logo {
display: block;
margin: 30px auto;
}
.form {
max-width: 400px;
padding: 20px;
margin: 30px auto;
}
.form-group {
margin-bottom: 30px;
}
.form-group label {
display: block;
}
.form-control {
margin: 0;
display: block;
width: 100%;
height: 36px;
padding: 6px 12px;
font-size: 16px;
line-height: 1.42857143;
color: #363636;
background-color: #ffffff;
background-image: none;
border: 1px solid #cccccc;
border-radius: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.btn {
display: block;
width: 100%;
margin-bottom: 0;
font-weight: normal;
text-align: center;
vertical-align: middle;
touch-action: manipulation;
cursor: pointer;
white-space: nowrap;
padding: 9px 22px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
color: #ffffff;
box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
background-image: none;
border: 0;
height: 50px;
font-size: 20px;
line-height: 1.3333333;
border-radius: 0;
font-weight: 700;
-webkit-transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
-o-transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.btn:focus {outline: 0;}
.btn:hover {background-color: #398023;}
.btn:active {
outline: 0;
background-image: none;
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
-webkit-transform: scale(0.95);
-ms-transform: scale(0.95);
-o-transform: scale(0.95);
transform: scale(0.95);
}
/* Zebra
.btn {background-color: #00a66e;}*/
/* EASI'R */
/*.btn {background-color: #81c074;}*/
/* Skoda */
.btn {background-color: #4ba82e;}
.contentbar {
/*border: 1px solid red;*/
width: 100%;
height: 110px;
}
.mainContent {
border: 1px solid gray;
width:100%;
height:100%;
}
.mainContent iframe {
/*border: 1px solid green;*/
width:100%;
height: 100%;
/*height:calc(100% - 150px);*/
}
I use the following to apply bootstrap:
<link rel="stylesheet" type="text/css" href="/css/bootstrap/bootstrap.css">
<script src="/js/bootstrap/bootstrap.js"></script>
See here my attached before and after pics.
Thanks
you might using a div with class "container" in html that's why everything is coming center.

Form outside table php

I have a problem with mapping together table and form. In my table I have some values that with help of a form I want to redirect to a page.I have read that I cannot put a form into a table so I tried not to. But if I let
<form>
<table>
structure, my display on page isn't very nice and I am not responsabile with frontend part but anyway I want to not be problems with it.If I let the table, without the form the display is ok(like in image). An image in left page and the table with the information in the right part. When using form, the table goes down and it's not good. So how to do? I try to include an image here to see how my page looks like without the form, but I really need to use the form. Any suggestion how to resolve this?I mean it's possible to have the display like in the photo but plus using a form and to not change the display?
EDIT: the css where tables are displayed
/* ==========================================================================
Tables
========================================================================== */
/*
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
text-align: left;
}
table th {
padding-right: 40px;
}
html {overflow-y: scroll; overflow-x: hidden;}
body {font-family: 'Open Sans', sans-serif; background:#f0eeed; color: #676767;}
.wrapper {width: 980px; margin: 0 auto;}
#content {padding: 20px 0 80px;}
.header:after {content:"";height:0;display:block;visibility:hidden;clear:both;}
.header {background: #ef8887; border-bottom: 3px solid #db7a78;}
.header .branding-title {float: left; margin: 0 0 0 5px; font: 0/0 serif; text-shadow: none; color: transparent; width:225px; height:125px;background:url(../img/branding-title.png) 0 6px no-repeat;padding: 6px 0;}
.header .branding-title a {display: block; height: 125px; width: 225px;}
.header .nav {float: right; top: 10; right: 0; margin: 0; position: relative; left: 15px; z-index: 99999999;}
.header .nav li {display: inline-block; margin: 0; list-style: none;}
.header .nav li a {
color: white;
text-decoration: none;
display: block;
line-height: 95px;
padding: 10px 0 0;
margin: 0 0 0 50px;
width: 100px;
text-align: left;
background: url('../img/nav-sprite.png') no-repeat 0px 105px;
white-space: nowrap;
text-transform: uppercase;
letter-spacing: 1px;
}
.header .nav li.on a {text-decoration:underline;}
.header .nav li a:hover, .header .nav li a:active {opacity: 0.7;}
.header .nav li.books a {background-position: 8px -5px;}
.header .nav li.movies a {background-position: 13px -105px;}
.header .nav li.music a {background-position: 15px -235px;}
.header .nav li.suggest a {background-position: 35px -340px;}
#content {min-height: 400px; background: white;}
.section.page:after {content:"";display:block;visibility:hidden;height:0;clear:both;}
.section.page {padding: 34px 0; background: white;}
.section.page h1 {
font-size: 24px;
text-align: center;
line-height: 1.6;
font-weight: normal;
}
.section.page .media-details h1 {
text-align: left;
}
.section.page p {width: 475px; margin-left: auto; margin-right: auto; }
.section.page .media-details h1 .price {color: #9d9f4e; padding-right: 10px; font-size: 34px;}
.section.catalog {padding-bottom: 42px;}
.section.catalog h2 {
font-size: 24px;
text-align: center;
line-height: 1.6;
font-weight: normal;
padding-top: 20px;
}
.section.catalog ul.items {margin: 0 0 -17px 0; padding: 0; width: 997px;}
.section.catalog ul.items li {
display: inline-block;
list-style: none;
width: 204px;
text-align: center;
padding: 14px;
margin: 0 0 17px 17px;
position: relative;
left: -17px;
}
.section.catalog ul.items li a:hover:after {
content: '+';
font-size: 50px; position: absolute; top:35px; right:30px; color: #3888c2; vertical-align: top;
}
.section.catalog ul.items li a {
background: white;
display: block;
padding: 30px 0 10px;
text-decoration: none;
}
.details-button {
color: #888;
}
.section.catalog ul.items li a:hover {
opacity: 1;
color: #666;
}
.section.catalog ul.items li img {
width: 190px;
border: 6px solid #f0eeed;
}
.section.catalog ul.items li p {
margin-left: 0;
margin-right: 0;
width: auto;
}
.media-picture {
float: left;
width: 400px;
text-align: center;
border: 1px solid #d9d9d9;
padding: 14px;
background: #f0eeed;
}
.media-picture span {
background: white;
display: block;
width: 100%;
padding: 36px 0 61px;
}
.media-picture img {width: 292px;}
.media-details {
width: 460px;
float: right;
}
.media-details form {
margin-left: 0;
}
td, th {
padding: 5px 5px;
}
form {width: 475px; margin: 34px auto;}
form tr, tr {text-align:left;vertical-align: top; padding:2px;}
form table {width: 475px; margin-bottom: 16px;}
form th {
width: 150px;
vertical-align: middle;
padding: 8px;
}
form td {
padding: 15px 15px;
}
form td select,
form td input,
form td textarea {
width: 100%;
border-radius: 4px;
padding: 10px;
border: 1px solid #a5a5a5;
font-size: 14px;
font-family: 'Open Sans', sans-serif;
}
form input[type="submit"] {
width: 475px;
text-align: center;
border: 0;
background: #3888c2;
color: #FFF;
-webkit-border-radius: 4px;
border-radius: 4px;
font-size: 16px;
padding: 14px 0 16px;
font-family: 'Open Sans', sans-serif;
}
form input[type="submit"]:hover {
background: #358dce;
cursor: pointer;
}
.search {
background: #f0eeed;
border-bottom: 3px solid #dddddd;
width:100%;
text-align:right;
}
.search form {
margin: 5px 5px 5px auto;
}
.search form input[type="submit"] {
width: auto;
text-align: center;
border: 0;
background: #3888c2;
color: #FFF;
-webkit-border-radius: 4px;
border-radius: 4px;
font-size: 16px;
padding: 6px;
font-family: 'Open Sans', sans-serif;
}
.page p.message {
background: #ffeca4;
border: 1px solid #f16702;
padding: 1em;
width: 444px;
}
.breadcrumbs {
font-size: 14px;
font-weight: normal;
padding: 14px 0 48px;
}
.breadcrumbs a {
text-decoration: none;
color: #3888c2;
}
.note-designer {
font-size: 14px;
font-style: italic;
font-weight: bold;
}
.footer {
background: #f0eeed;
border-top: 3px solid #dddddd;
padding: 42px 0;
font-size: 12px;
color: #a5a5a5;
}
.footer ul {margin: 0; padding: 0; float: left;}
.footer ul li {
margin: 0;
padding: 0;
list-style: none;
display: inline-block;
}
.footer ul li:after {content:" | "}
.footer ul li:last-child:after {content:"";}
.footer p {margin: 0; padding-right: 3px;}
.footer a {text-decoration: none; color: #539def; margin: 0 10px;}
.footer li:first-child a {margin-left: 4px;}
.footer a:hover, .footer a:active {text-decoration: underline;}
sorry for the long code but this is what I found in style css
As mentioned previously, avoid using tables for anything but actual tabular data. Using it to position elements on the page is unpredictable at best.
You said that you aren't responsible for the front end, but do you have access to the HTML? I'm sure many of us could give you some helpful suggestions but we need a reference point beyond a screenshot :).
You might want to check out how some CSS frameworks handle this, it might give you some inspiration (http://getbootstrap.com/css/#forms). I'm not a big Bootstrap guy but there are a lot of basic examples here on form / table formatting.
You should be able to put just about anything inside a form tag without affecting the way anything on the page looks. Assuming you can't just stop using tables asap, you may have to play around with the css to clean this up. If the form tag is affecting the way anything embedded inside it looks then you might have something in your CSS styling the form element. If possible I would eliminate this styling if it exists.

How do I change the width size of the blocks in Moodle? It is CSS? What is the file?

o css no caminho /www/moodle/theme/mytheme/style : custom.css
/* Custom CSS
-------------------------*/
body {
background: url([[pix:theme|bg]]) repeat scroll 0 0 rgba(0, 0, 0, 0);
padding-top: 60px;
color: #58585A;
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 20px;
margin: 0;
}
#page {
padding-top: 47px;
}
a.logo {
background: url([[setting:logo]]) no-repeat 0 0;
display: block;
float: left;
height: 75px;
margin: 0;
padding: 0;
width: 100%;
}
.dir-rtl a.logo {
background: url([[setting:logo]]) no-repeat 100% 0;
display: block;
float: right;
}
.navbar-inner{
background: #F5F5F5;
}
.navbar .navbar-inner a.brand span {
display: none;
}
.navbar .navbar-inner a.brand {
background-image: url([[pix:theme|logo]]);
background-position: center center;
background-repeat: no-repeat;
min-height: 74px;
padding: 5px 20px;
width: 214px;
}
.navbar .nav {
margin-top: 17px;
}
.navbar-text, .navbar .nav > li > a{color:#E8770D;}
.breadcrumb {
border-radius: 4px;
list-style: none outside none;
margin: 0 0 20px;
padding: 8px 15px;
background-color: #FFFFFF;
border: 1px solid #E0E0E0;
}
.coursebox {
border: 1px dotted #DDDDDD;
border-radius: 4px;
margin-bottom: 15px;
padding: 5px;
background:#f5f5f5;
}
/* Custom CSS Settings
-------------------------*/
[[setting:customcss]]
Moodle puts all the css into one file for speed. To turn this off, add this line to config.php - on a development site not a production site...
$CFG->themedesignermode = true;
Then in Chrome, refresh the page, right click on the block and inspect element. It should now show the original css file.
After you have finished, remove the themedesignermode line or set it to false because it will make the site verrrry slow... http://docs.moodle.org/dev/Creating_a_theme#Theme_designer_mode
You might also need to purge the cache after making any changes - http://docs.moodle.org/26/en/Purge_all_cache

php array goes vertical instead of horizontal after styling

I have an array of letters. After I added the styling, the array went from horizontal to vertical.
here is the code:
$alphabetical_array = range('a','z');
function AddLinks($letter)
{
$title = strtoupper($letter);
$a = "<a href='alpha_search.php?letter=".$letter."' class='alphabtn'><font color='#FFFFFF'>".$title."</font></a>";
return($a);
}
$format_array = array_map("AddLinks", $alphabetical_array);
echo implode($format_array);
here is the css:
.alphabtn {
max-width:10px;
text-decoration: none;
position: relative;
padding: 5px ;
text-align:left;
clear: both;
text-indent:0;
display: block;
font: bold 12px/14px Arial, Helvetica, sans-serif;
text-transform: uppercase;
color: #fff;
border-radius: 4px;
border: 1px solid #391b61;
text-shadow: 1px 1px 1px #ccc;
background: -moz-linear-gradient(top, #864fd3 0%, #553285 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#864fd3), color-stop(100%,#553285));
background: -webkit-linear-gradient(top, #864fd3 0%,#553285 100%);
background: -o-linear-gradient(top, #864fd3 0%,#553285 100%);
background: -ms-linear-gradient(top, #864fd3 0%,#553285 100%);
background: linear-gradient(to bottom, #864fd3 0%,#553285 100%);
-pie-background: linear-gradient(#864fd3, #553285);
-webkit-box-shadow: inset 0px 1px 1px 1px #a55aff;
box-shadow: inset 0px 1px 1px 1px #a55aff;
behavior: url(../login/_ui/js/PIE.htc);
}.alphabtn:hover {
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #553285), color-stop(1, #864fd3) );
background:-moz-linear-gradient( center top, #553285 5%, #864fd3 100% );
background: -moz-linear-gradient(top, #553285 0%, #864fd3 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#553285', endColorstr='#864fd3');
background-color:#553285;
}.alphabtn:active {
position:relative;
top:1px;
}
you have
clear: both;
set on your tag. pretty sure this will cause the
<a>
to be treated as block and break to a new line.
Try removing it.
You have display: block; in the css. That will cause each element to display on its own line. Remove it and everything else should be fine.
Change
.alphabtn {
max-width:10px;
text-decoration: none;
position: relative;
padding: 5px ;
text-align:left;
clear: both;
text-indent:0;
display: block;
to
.alphabtn {
max-width:10px; //Why this line?
text-decoration: none;
position: relative;
padding: 5px ;
text-align:left;
text-indent:0;
display: inline-block; (or delete the row)

Why don't I have a scroll bar?

I'm making a website in HTML, CSS, and PHP and the page goes way beyond the screen but there is no scroll bar provided by the browser (Safari 5.0.6 and Firefox 14.0.1 on Mac). Is it because I included the PHP? But shouldn't that be there before the page is rendered?
Here is a link: test website
My PHP syntax:
<div id="content">
<div class="wrapper">
<div id="home" class="alert">
Welcome to always4freeĀ©! To browse the classifieds, you must first either choose a location or have your location detected.
</div>
<?php include "res/pages/categories.php"; ?>
</div>
</div>
</div>
What is going on?
EDIT: Here is my CSS:
body {
background-image: url("http://always4free.org/site/images/bg.jpg");
background-size: cover;
font-family: "Mouse Memoirs",sans-serif;
}
.wrapper {
margin: 0 auto;
width: 850px;
}
#header {
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5);
border-bottom: 3px solid green;
box-shadow: 0 2px 10px #888888;
height: 50px;
left: 0;
position: fixed;
top: 0;
width: 100%;
}
#logo {
color: rgba(255, 255, 255, 0.7);
float: left;
font-family: "Wendy One",sans-serif;
font-size: 30px;
line-height: 50px;
width: 250px;
}
#logo a:hover {
color: #FFFFFF;
}
#nav {
float: right;
line-height: 50px;
width: 600px;
}
#nav a:first-child {
margin-left: 0;
}
#nav a:last-child {
margin-right: 0;
}
#nav a:link, #nav a:visited {
color: rgba(255, 255, 255, 0.9);
font-family: "Mouse Memoirs",sans-serif;
letter-spacing: 1px;
margin-left: 10px;
margin-right: 10px;
}
#nav a:hover {
border-bottom: 2px solid #FFFFFF;
color: #FFFFFF;
padding-bottom: 1px;
}
#nav a.detect {
background-color: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 2px 2px 2px 2px;
color: rgba(0, 0, 0, 0.7);
padding: 5px;
}
#nav a.detect:hover {
color: #000000;
}
#content {
font-family: "Mouse Memoirs",sans-serif;
letter-spacing: 1px;
margin-top: 70px;
}
.page {
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5);
border: 1px solid green;
color: #FFFFFF;
font-size: 20px;
padding: 10px;
}
.alert {
background: none repeat scroll 0 0 #AD2E1D;
border: 1px solid #911E0F;
color: white;
font-size: 20px;
padding: 10px;
text-align: center;
}
#categories {
margin-top: 20px;
}
#categories h2 {
color: rgba(255, 255, 255, 0.7);
font-family: "Wendy One",sans-serif;
font-size: 26px;
}
#categories a:link, #categories a:visited {
background: none repeat scroll 0 0 white;
color: black;
padding: 3px;
}
#categories .block {
line-height: 35px;
}
You have all of your content wrapped inside an element of position: fixed;. The body is not able to retrieve the height of fixed or absolute children and is therefore set to an actual height of 0 - thus eliminating any need for scrolling.
If you move your #content element outside of the fixed header things should be working as expected.
Move your div with id content outside of your header div.
It will solve your problem.
Add a clearfix class with your .wrapper so that it have a height and then use:
.wrapper{
overflow: scroll;
}
add overflow: scroll; in your #header style and change position to relative.
#header {
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5);
border-bottom: 3px solid green;
box-shadow: 0 2px 10px #888888;
height: 50px;
left: 0;
position: **relative**;
top: 0;
width: 100%;
**overflow: scroll;**
}

Categories