Text going out of the div.Nothing I have tried seems to work.Example the word red going out of the div.
I have 2 divs floating next to each other shown with green and red borders.Div 1 has images coming from a databse. Div 2 which I have named #index wraps around div class='board' blue border as shown in the image,which holds the description coming from MYSQL database.
Code on index.php:
<div id="index">
<?php
$select = "SELECT * FROM products LIMIT 0,20";
$query = mysqli_query ($conn,$select);
while ($row = mysqli_fetch_assoc($query)){
$B = $row['Brand']; $P = $row['Product']; $D = $row['Description'];
$M = $row['Model'];$Id = $row['Id'];
echo "<div class='board' style='word-wrap: break-word;'><a href =
'redirect.php?id=$Id'><h2>     
".$B." ".$P." ".wordwrap($D,28,"<br>\n",TRUE)." ".$M."</h2>
</a></div>";
}
?>
</div>
CSS:
#index {
border:solid 1px red;
position:relative;
float:left;
width:59%;
height:100%;
word-wrap:break-word;
}
div.board {
width:480px;
}
.board {
background:white;
position:relative;
border-radius:15px;
border-color:#0033FF;
border-width:2px;
border-style:solid;
margin-top:31px;
width:480px;
height:195px;
padding-left:0px;
margin-left:0px;
word-wrap:break-word;
white-space:normal;
}
<div id="index">
<?php
$select = "SELECT * FROM products LIMIT 0,20";
$query = mysqli_query ($conn,$select);
while ($row = mysqli_fetch_array($query)){
$B = $row['Brand']; $P = $row['Product']; $D = $row['Description'];
$M = $row['Model'];$Id = $row['Id'];
echo "<div class='board' ><a href = 'redirect.php?id=$Id'>
<h2>".$B." ".$P." ".$D." ".$M."</h2></a></div>";
}
?>
</div>
CSS:
#index {
position:relative;
top:15px;
float:left;
width:482px;
height:100%;
}
.board {
background:white;
position:relative;
border-radius:15px;
border-color:#0033FF;
border-width:1px;
border-style:solid;
margin-top:29px;
height:198px;
padding-left:18px;
padding-right:0px;
margin-left:0px;
float:left;
word-wrap: break-word;
}
Related
I want to hide fixed-button id and anilogg_buddypress class from my login page How can I achieve this in WordPress?
function anilogg_footer() {?>
<style>
#media only screen and (min-width:481px){
.fixed-menu{
display:none;
}
#fixed-button{
display:none;
}
}
#media only screen and (max-width: 480px) {
ul.fixed-menu{
position:fixed;
bottom:0;
width:100%;
background:white;
height:50px;
border-top:1px solid #e40000;
}
.fixed-menu li {
display:inline-block;
text-align:center;
color:#e40000;
width:23%;
line-height:50px;
font-size:1.5rem;
}
.fixed-menu li:2n{
border-left:1px solid #fff;
}
#fixed-button a{
display:block;
width:50px;
height:50px;
background:#e40000;
color:white;
position:fixed;
right:15px;
bottom:65px;
border-radius:50%;
text-align:center;
line-height:50px;
font-size:2rem;
}
}
</style>
<div id="fixed-button">
<a href="#" class="fixed-menu">
<span class="icon-videocam"></span>
</a>
</div>
<div class="anilogg_buddypress">
<ul class="fixed-menu">
<li><span class="icon-home"></span></li>
<li><span class="icon-mail"> </span></li>
<li><span class="icon-bell"></span></li>
<li><span class="icon-user"></span></li>
</ul>
</div>
<?php }
add_action( 'wp_footer', 'anilogg_footer' );
if(is_page('login')){
?>
<style>
.fixed-menu{
display:none;
}
#fixed-button{
display:none;
}
</style>
<?php }
else{
}
I expect that the anilogg_buddypress class and fixed-button id div should not be visible on the login page. (There is a page named login Not default login page of WordPress). I have made function anilogg_footer for displaying a bottom menu in the website. For which I have added a action.
I'm working on a searchbar that has a js dropdown for categories. The searchbar needs to be responsive to width changes and at the moment the general layout is fine. I'm having one problem of positioning the dropdown menu relative to the category button. As it is now, the dropdown pushes the searchbar content down.
I have applied z-index, but no joy.
I have put the category dropdown within the new-sb-container, but still no joy. Any help greatly appreciated.
<div id="new-sb-container">
<div id="search">
<form id="search-form" method="post" action="">
<input type="text" name="q" id="query" placeholder="Search..."/>
<div id="search-category" title='Select a search category'>All Categories</div>
<div id="search-category-menu">
<label id='search-options'>Search Options:</label><br/>
<input type="radio" name="search_category" id='all_categories' value="all" checked><label for='all_categories'>All Categories</label><br/>
<input type="radio" name="search_category" id='antiques' value="antiques"><label for='antiques'>Antiques</label><br/>
</div> <!--end category menu-->
</form>
</div> <!--end search container-->
<div id="search-submit"><form><input type="submit" id='search-submit' value="Search"></form> </div>
</div><!--end sb container-->
#new-sb-container{
clear:both;
overflow:hidden;
width: 60%;
margin-top: 20px;
}
div#search
{
overflow:hidden;
width: 70%;
background-color: #FFFFFF;
border: 1px solid #CCCCCC;
border-top-left-radius: 7px;
border-bottom-left-radius: 7px;
padding-left: 10px;
float:left;
z-index: 1;
position:relative;
}
#search-form{
position: relative;
float:left;
width: 100%;
z-index: 0;
}
input#query{
position:relative;
float:left;
width: 60%;
height: 27px;
border: 1px solid #FFFFFF;
overflow:hidden;
}
div#search-category /*grey category box*/
{
border-radius: 7px;
font-family: Verdana,Arial,sans-serif;
font-size: 11px;
display:inline;
background-color: #CCCCCC;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 7px;
padding-right: 7px;
cursor: default;
margin-right:5px;
float:right;
}
div#search-category-menu
{
float:right;
position:relative;
width: 150px;
background-color: #FFFFFF;
border: 1px solid #000000;
padding: 8px;
margin-top: 10px;
z-index:99;
float:right;
}
div#search-submit{
position:relative;
float:left;
width:20px;
}
As the code stands the search-category-menu is relative to search-form > search > sb-new container.
and the jq form if this help...
$(document).ready(function()
{
function search_autocomplete(selector, tags, default_value)
{
$('#' + selector).focus(function()
{
if($('#' + selector).val() == default_value)
{
$('#' + selector).val('');
}
});
$('#' + selector).blur(function()
{
if($('#' + selector).val() == '')
{
$('#' + selector).val(default_value);
}
});
var search = $('#' + selector).autocomplete(
{
source: tags,
timeout: 0,
select: function(event, ui)
{
var selected_object = ui.item;
var search = selected_object.value;
search = search.replace(/\s+/g, '-').toLowerCase();
var category = $('input[name="search_category"]:checked').val();
$("#search-form").attr("action", "/search/" + search + "/category/" + category);
$("#search-form").submit();
}
});
$('#' + selector).data('ui-autocomplete')._renderItem = function (ul, item)
{
var re = new RegExp('^' + this.term, "i");
var t = item.label.replace(re, "<span id='dropdown-item-highlight'>" + "$&" + "</span>");
return $('<li></li>')
.data("item.autocomplete", item)
.append('<a> ' + t + '<span id="dropdown-category"> in ' + item.type + '</span></a>')
.addClass( 'dropdown-item' )
.appendTo(ul);
$('<li></li>').append('<a>Hide suggestion</a>').appendTo(ul);
};
$('#' + selector).data('ui-autocomplete')._renderMenu = function (ul, items)
{
var that = this;
$.each( items, function( index, item )
{
that._renderItemData( ul, item );
});
$(ul)
.attr( 'tabindex', -1 )
.addClass('dropdown-menu');
$('<li></li>')
.append('<a>Hide Suggestion</a>')
.addClass( 'dropdown-suggestion' )
.appendTo(ul);
};
}
$('#search-category-menu').hide();
$('#search-category-menu input[type="radio"]').click(function()
{
var category = $(this).next("label").text();
$('#search-category').text(category);
$('#search-category-menu').hide();
//not focusing by selector
$('#query').focus();
});
$('#search-category').click(function()
{
if ($('#search-category-menu').is(":visible"))
{
$('#search-category-menu').hide("fast");
}
else
{
$('#search-category-menu').show("fast");
}
});
var availableTags = [{"label" : "XBOX 360", "type":"Electronics"},
{"label":"XBOX One", "type":"Electronics"},
{"label":"Nike", "type":"Clothing & Footwear"}];
search_autocomplete('query', availableTags, 'Search...');
});
Fixed with the folowing
take category drop down out of container.
place a span element with width at similar percentage as category button movement.
make drop down relative to absolute span
apply z indexes to span and drop down.
code below
<div id="new-sb-container">
<div id="search">
<form id="search-form" method="post" action="">
<input type="text" name="q" id="query" placeholder="Search..."/>
<div id="search-category" title='Select a search category'>All Categories</div>
</form>
</div> <!--end search container-->
<div id="search-submit"><form><input type="submit" id='search-submit' value="Search"></form></div>
</div><!--end sb container-->
<span id = "menuplacer">
<div id="search-category-menu">
<label id='search-options'>Search Options:</label><br/>
<input type="radio" name="search_category" id='all_categories' value="all" checked><label for='all_categories'>All Categories</label><br/>
<input type="radio" name="search_category" id='antiques' value="antiques"><label for='antiques'>Antiques</label><br/>
</div> <!--end category menu-->
</span>
#menuplacer{
clear:both;
width:41%;
position: absolute;
}
div#search-category-menu
{
width: 150px;
background-color: #FFFFFF;
border: 1px solid #000000;
padding: 8px;
margin-top: 10px;
z-index:1000;
position:relative;
float:right;
}
I have a calendar that I created in PHP
the problem is, it is not displayed well in Internet Explorer
In Chrome all is well
I use DIV instead of Table
The complete code here and you can see a demo here
http://www.guadadvent.org/calendrier_essaie.php
.today{
font-weight:bold;
color:red;
}
.mois {
background:#FFF;
height:30px;
line-height:30px;
width:100%;
text-align:center;
margin-right:-100px;"
}
.jours {
background:#FFF;
border:1px #999933 solid;
padding:5px;
height:30px;
line-height:30px;
width:100px;
float:left;
text-align:center;
margin-right:-3px;
margin-bottom:1px;"
}
.cellule {
background:#FFF;
border:1px #999933 solid;
padding:5px;
height:70px;
width:100px;
float:left;
text-align:right;
margin-right:-3px;
margin-bottom:1px;
}
.cellule_vide {
padding:5px;
height:70px;
width:100px;
float:left;
text-align:right;
margin-right:-1px;
margin-bottom:1px;"
}
.cellule:hover {
background:#CCC;
border:1px solid red;
}
.separateur {
style="clear:both;"
}
.cadre {
display:inline-block;
background:#CCC;
position:relative;
}
.nav_gauche {
position:absolute;
top:0px;
left:0px;
text-decoration:none;
padding-left:50px;
}
.nav_droite {
position:absolute;
top:0px;
right:0px;
text-decoration:none;
padding-right:50px;
}
</style>
<?php
$tabmois = array ("","Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre");
$tabjours = array ("","Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");?>
<?php $an=$_REQUEST["a"];
if(empty($an)) $an=date("Y");
$mois=$_REQUEST["m"];
$jour_serveur=date("j");
$mois_serveur=date("m");
if(empty($mois)) $mois=$mois_serveur;
if($mois==12) $mois_suivant=1; else $mois_suivant=$mois+1;
if($mois==1) $mois_precedent=12; else $mois_precedent=$mois-1;?>
<?php
$premJourdumois = date("w" , mktime(0,0,0,$mois,1,$an) )+1;// en chiffre, +1 si calendrier comence par dimanche, soit 1 pour dimanche
$nbJoursdanslemois = date("t" , mktime(0,0,0,$mois,1,$an)); // respecte les années bixectiles
$nbdecellulesvidesavantdebut = $premJourdumois-1; // nom de variable explicite
?>
<div class="cadre">
<div class="mois">
<div class="nav_gauche" > << </div>
<?php echo $tabmois[$mois];?>
<div class="nav_droite"> >> </div>
</div>
<div class="separateur"></div>
<?php // les jours
for ($i=1;$i<=7;$i++) {?>
<div class="jours"><?php echo $tabjours[$i];?> </div>
<?php } ?>
<div class="separateur"></div>
<?php // cellules vide avant le debut de l'affichage
for ($i=1;$i<=$nbdecellulesvidesavantdebut;$i++) {?>
<div class="cellule_vide"></div>
<?php }?>
<?php // affichage du calendrier
for ($i=1;$i<=$nbJoursdanslemois;$i++) {?>
<?php if(($i==$jour_serveur) and ($mois==$mois_serveur)) $auj="today"; else $auj=""; // si c'est le jour d'aujourd'ui on met une classe spéciale?>
<div class="<?php echo $auj;?> cellule"><?php echo $i;?></div>
<?php // saut si on liste une semaine soit 7 jours
if(($i+$nbdecellulesvidesavantdebut)%7 == 0 ) {?>
<div class="separateur"></div>
<?php }?>
<?php }?>
</div>
i'm trying to get images that im echoing to display inline-block/horizontal but instead whatever i do they are just listing down/vertically. how can i fix this?
here's my code:
<div class="profile_photos_area">
<?php
$dirname = "./data/photos/".$profile_id."/";
$images = scandir($dirname);
$ignore = Array("_cover.jpg", "_default.jpg");
foreach($images as $curimg){
if(!in_array($curimg, $ignore) && preg_match("/\.jpg$/i", $curimg)) {
echo "<img src='".$dirname.$curimg."' class=\"profile_photos\"><br>\n";
};
}
?>
</div>
.profile_photos{
margin-top:0px;
border:#ccc 1px solid;
width: 170px;
height: 150px;
display:inline-block;
position:relative;
}
.profile_photos_area{
width:665px;
height:350px;
background:#000;
margin-left:-193px;
display:inline-block;
overflow:hidden;
}
Did you look at the html your code generate? Look at the asterisks :
echo "<img src='".$dirname.$curimg."' class=\"profile_photos\">******<br>******\n";
br. br!
It is html, and it means... break line! Just remove that.
demo
I am having a hard time applying CSS to some pagination links. I would like the links to show horizontally at the bottom of the page, centered:
1 2 3 > >>
Right now with the CSS, they show vertically, centered, and near the top of the page:
1
2
3
>
>>
What sort of CSS can I apply to the "pages" class in order to get these links displayed as I would like?
Thanks in advance,
John
if ($currentpage > 1) {
echo " <div class='pages'><a href='{$_SERVER['PHP_SELF']}?currentpage=1&find={$_SESSION['find']}' class='links'><<</a></div> ";
$prevpage = $currentpage - 1;
echo " <div class='pages'><a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage&find={$_SESSION['find']}' class='links'><</a></div> ";
} // end if
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
if (($x > 0) && ($x <= $totalpages)) {
if ($x == $currentpage) {
echo " <div class='pages'>[<b>$x</b>] </div>";
} else {
echo " <div class='pages'><a href='{$_SERVER['PHP_SELF']}?currentpage=$x&find={$_SESSION['find']}' class='links'>$x</a></div> ";
} // end else
} // end if
} // end for
if ($currentpage != $totalpages) {
$nextpage = $currentpage + 1;
echo " <div class='pages'><a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage&find={$_SESSION['find']}' class='links'>></a></div> ";
echo " <div class='pages'><a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages&find={$_SESSION['find']}' class='links'>>></a></div> ";
} // end if
The CSS:
.pages
{
text-align: center;
margin-top: 10px;
margin-bottom:0px;
padding:0px;
font-family: Arial, Helvetica, sans-serif ;
}
a.links:link {
color: #000000; text-decoration: none;
text-align:center;
margin-left:8px;
margin-bottom:0px;
padding:2px;
font-family:Arial, Helvetica, sans-serif;
font-size: 16px;
}
Two things:
You need to put an entity reference in for the anchor text. That means > instead of >; and
You can put the links in a row in multiple ways, including making them display: inline or if you want more control over margins use float: left although this will have other affects on your layout.
For example, this is the sort of navigation you should be aiming for:
<div id="nav">
1
2
3
>
>>
</div>
with:
#nav { overflow: hidden; }
#nav a { display: block; float: left; margin: 4px 8px; }
#nav a:hover { background: #CCC; color: white; }
The HTML is minimal and to the point. Prefer making anchors (<a>) display: block instead of putting them in a <div> because this way they will be clickable anywhere within the box, not just on the number/symbol text. Larger target areas are better.