Issue with CSS, HTML and background colors. - html

I have the following issue.
I have 2 sets of checkboxes with a title for each. That title is supposed to have a grey background, then the checkboxes area should have no color in the background.
The issue is that if I put only 1 set of checkboxes with its title, the backgrounds work good.
However, when I put the 2nd set of checkboxes, the checkboxes area of the 1st set has a grey background and seems to be inheriting the bg of the title of the 2nd set.
Here is the code. Any clue?
Thanks!
<div class="bgFilterTitles">
<h1 class="filterTitles">COLOR</h1>
</div>
<div class="boxes">
<?php
$colors = $con -> prepare("SELECT DISTINCT color_base1 FROM item_descr ORDER BY color_base1 ASC");
$colors ->execute();
while ($colorBoxes = $colors->fetch(PDO::FETCH_ASSOC))
{
echo "<input type='checkbox' class='regularCheckbox' name='color' value='".$colorBoxes[color_base1]."' /><font class='similarItemsText'> ".$colorBoxes[color_base1]."</font><br />";
}
?>
</div>
<div class="bgFilterTitles">
<h1 class="filterTitles">PRICE</h1>
</div>
<div class="boxes">
<?php
$prices = $con -> prepare("SELECT DISTINCT price FROM item_descr ORDER BY price ASC");
$prices ->execute();
while ($priceSort = $prices->fetch(PDO::FETCH_ASSOC))
{
echo "<input type='checkbox' class='regularCheckbox' name='price' value='".$priceSort[price]."' /><font class='similarItemsText'> ".$priceSort[price]."</font><br />";
}
?>
</div>
Here are the CSSs used:
.boxes {
width: 160px;
float: left;
padding: 10px;
border: 1px solid #C6C6C6;
clear: both;
}
.filterTitles
{
background-color: #F1F1F1;
font-family: Arial,Helvetica,Verdana,Sans-serif;
font-size: 11px;
font-weight: normal;
color: #333;
text-transform: uppercase;
padding: 4px;
border: 1px;
border-color: #C6C6C6;
border-top-style: dotted;
}

I'm not sure if I understood the problem correctly, is this what you were trying to do?
http://jsfiddle.net/mdLVG/
In that case you need to add clear:both; to your .filterTitles CSS class.

Related

Show breadcrumb with text-overflow css

I have a breadcrumb which I need to cut / shorten the breadcrumb if it's too long with text-overflow css. I have tried and confused to make a different color link only in last breadcrumb. In my breadcrumb, max breadcrumb to show is 4.
From the code below, I success to shortened breadcrumb using text-overflow: ellipsis. Like if breadcrumb have 4 link, I using foreach to show breadcrumb that index number 2 and index number 3 is too long, I shortened them using text-overflow: ellipsis. If the breadcrumb have 3 link, I used same looping too.
I want to ask how can I make different color text / link only in the last breadcrumb like if breadcrumb have 3 link, index number 2 is have different color than others. And if breadcrumb have 4 link, index number 3 is have different color ?
Here's the html code
<?php if (isset($breadcrumbs)): ?>
<?php
$numItems = count($breadcrumbs);
$i = 0;
//echo $numItems;
?>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<?php foreach ($breadcrumbs as $breadcrumb): ?>
<?php if ($i == 0 || $i == 1): ?>
<li class="breadcrumb-item"><?= $breadcrumb['text'] ?></li>
<?php else: ?>
<li class="breadcrumb-item"><?= $breadcrumb['text'] ?> </li>
<?php endif ?>
<?php $i++; ?>
<?php endforeach ?>
</ol>
</nav>
<?php endif ?>
Here's the css code
.breadcrumb {
padding: 5px 0px;
margin-bottom: 0px;
background-color: #ecf0f5;
}
.breadcrumb-item+.breadcrumb-item::before {
content: ">";
font-size: 12px;
}
.breadcrumb-item {
font-size: 14px;
}
.breadcrumb-item .last{
display: inline-block;
width: 100px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
line-height: 10px;
}
.breadcrumb-item a{
color: #535353;
}
.breadcrumb-item:hover > a{
color: #1787fa
}
.mini-breadcrumb{
display: none;
}
Thank you
Try this css on your .breadcrumb-item:
.breadcrumb-item:last-of-type a{
color: grey;
}
use your desired color instead of grey.
You can also use :last-child selector.
.breadcrumb-item:last-child a {
color: grey;
}
Just adding another link where you can find difference between type-of and child difference.
What is the difference between :first-child and :first-of-type?

CSS Border Styling CSS, HTML & PHP

I would like to add a border style of white to the bottom of td-fault table only.
My CSS CODE:
background, body{
background-color: black;
}
table-eng, p{
width: 650%;
font-size: 15pt;
color: #ffffff;
border-bottom-style: none;
}
table-cust, tr{
font-size: 13pt;
color: #4CBB17;
}
td-fault, td{
font-size: 11pt;
color: #ffffff;
border-bottom: 1px solid white;
}
Here is my HTML/PHP:
<html>
<link href="../css/job-board.css" rel="stylesheet">
<div id="backgroud">
<body>
<table>
<td>
<?php
include('connectionDB.php');
$sql = "SELECT * FROM [Support_DB].[dbo].['Job info$'] WHERE [Job Completed?]= 0 AND [Attended by]='James'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$results=$stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<div id='table-eng'>
<table>
<tr>
<th>
<p>James</p>
</th>
</tr>
</table>
</div>
<?php foreach ($results as $row) {
echo "<div id='table-cust'>";
echo"<table>";
echo"<tr>";
echo"<th align='left'>";
echo $row['Customer'];
echo"</th>";
echo"<th>";
echo $row['Job Number'];
echo"</th>";
echo"</tr>";
echo"<tr>";
echo"</div>";
//echo"<div id='td-fault'>";
echo"<td class='td-fault'>";
echo wordwrap($row['Fault'],85,"<br>\n",TRUE);
echo"</td>";
echo"</tr>";
//echo"</div>";
echo"</table>";
//echo"</div>";
//echo"</div>";
}?>
The company Name and job number need to be in white if possible on a continuous line so looks smoother as I nearly had it how I wanted it but I mucked up and couldn't get it correct again.
The reason is because you're missing the . for td-fault in your CSS.
Try the following:
.td-fault {
font-size: 11pt;
color: #ffffff;
border-bottom: 1px solid white;
}
Also table-eng and table-cust is missing # like so
#table-eng and #table-cust

Issue with styling li in carousel navigation

I'm working on "Related Articles" widget carousel navigation in WordPress. Widgets is working fine and now I'm working on styling part.
This is what I currently have:
This is what I want to achieve:
The problem is that I'm stuck on styling li. The problem is that I'm trying first of all to add width and height even with !important and it's still not re-sizing. So I need to split this carousel navigation into 8 similar parts. I think display:inline / display:inline-block might cause this issue.
CSS:
div.carousel_navigation {
display: inline-block;
background: #eeebe7;
width: 224px;
position: relative;
border-right: 1px solid #b1afa9;
border-left: 1px solid #b1afa9;
border-bottom: 1px solid #b1afa9;
}
ul li.prev-article, ul li.next-article {
display: inline;
width: 28px;
height: 20px;
}
li.nav-item-links {
display: inline;
width: 28px;
height: 20px;
}
PHP:
<div class="carousel_navigation">
<ul>
<li class="prev-article"><a class="prev-article"><</a></li>
<?php $count = 1; foreach( $related_posts_guides as $post): // variable must be called $post (IMPORTANT) ?>
<li class="nav-item-links">
<a href="#item_<?php echo $count; ?>">
<?php echo $count; ?>
</a>
</li>
<?php $count++; endforeach; ?>
<li class="next-article"><a class="next-article">></a></li>
</ul>
</div><!-- .carousel_navigation -->
Thank you in advance!
That's because your li elements are inline. If you want them to be in line with eachother, but also stylable with properties like height and width, you'll need to set them as inline-block instead:
ul li.prev-article, ul li.next-article,
li.nav-item-links {
display: inline-block;
width: 28px;
height: 20px;
}
Note that I've also joined both of your selectors with a comma as their style properties were identical.

Removing border from last div

I'm struggling to remove the border from my last div, here's my code:
<div class="media">
<a class="pull-left" href="producten.php?product=<?php echo $key; ?>">
<img class="media-object" src="img/<?php echo $key; ?>.png">
</a>
<div class="media-body">
<h4 class="media-heading"><?php echo $output["naam"]; ?></h4>
<div class="row">
<div class="col-sm col-xs-10">
<p><?php echo $output["omschrijving"]; ?></p>
</div>
<div class="col-sm-2 col-xs-2">
<p class="pull-right">Prijs:<b><?php echo $output["prijs"]; ?></b></p>
</div>
</div>
</div>
</div>
and my CSS:
.media {
padding-left: 1em;
padding-right: 1em;
border-bottom: 1px solid #000;
padding-top: 10px;
padding-bottom: 10px;
}
.media:last-of-type {
padding-left: 1em;
padding-right: 1em;
padding-top: 10px;
padding-bottom: 10px;
color: red;
}
But this doesn't seem to work, please note that I'm using Bootstrap en forgive me that some words are in Dutch or the PHP may be rubbish (But that's why I'm learning).
IE7/IE8 doesn't support last-child AFAIK.
Maybe you could reverse the order of the borders, instead of removing (border-bottom) from the last one, then remove it (border-top) from the first one instead? You wouldn't even need to put it on:
.media + .media {border-top: 1px solid #000000;}
Or something similar to someway reverse it and aim for the first child instead (or everyone but the first child as above)
EDIT: Updated code to probably suit your example better
:last-child only works when the element in question is the last child of the container. :last-of-type is for the last of a specific type of element.
.media:last-child {
border:none;
}
Try something like this:
div.media:last-child{
}
what about to reset borders too ?
.media:last-of-type {
padding-left: 1em;
padding-right: 1em;
padding-top: 10px;
padding-bottom: 10px;
color: red;
border:none;
}
You can try below code:
.media:last-child{
border:0;
}

Box-shadow is not showing or z-index

i have tried as much i know about this stuff but failed to show box-shadow over the image.
http://thesameffect.com/healthy-habits-and-distinctions/#related-posts
i want to show shadow overlayed on the images. same like as ..
http://thesameffect.com/blog/
Please kindly help me..
HTML :
<div class="related-posts">
<h3 class="related-title">Related Posts</h3>
<ul id="related-posts" class="related-list">
<li>
<a title="Permanent Link toHow Genetics and Epigentics Relate to Your Health and Fitness" rel="bookmark" href="http://TheSamEffect.com/how-genetics-and-epigentics-relate-to-your-health-and-fitness/">
<img class="attachment-Header Square" width="297" height="200" title="genes2" alt="genes2" src="http://TheSamEffect.com/wp-content/uploads/genes2-297x200.jpg">
<span class="related-heading">How Genetics and Epigentics Relate to Your Health and Fitness</span>
</a>
</li>
<li>
...
</li>
<li>
...
</li>
</ul>
</div>
CSS :
.related-posts ul {
list-style: none outside none;
margin: 0;
padding: 0;
}
.related-list li {
background-color: #F4F4F4;
box-shadow: 0 0 10px #000000 inset;
float: left;
height: 150px;
list-style: none outside none !important;
margin: 0.25em !important;
overflow: hidden;
position: relative;
text-align: center;
width: 216px;
}
.related-posts ul li a {
font-size: 14px;
font-weight: normal;
line-height: 20px;
text-decoration: none;
}
.related-posts a {
color: #F4F4F4;
}
.related-list img {
display: block;
margin: 0;
position: absolute;
}
.related-heading {
background-color: rgba(0, 0, 0, 0.5);
bottom: 0;
font-family: Conv_resea-bolditalic,"Helvetica Neue",Arial,Helvetica,sans-serif,georgia;
font-size: 16px;
left: 0;
min-height: 40px;
padding: 10px;
position: absolute;
width: 90.5%;
z-index: 1;
}
PHP - WP Codes :
Thats how i am extracting images from genesis.
$img = genesis_get_image() ? genesis_get_image( array( 'size' => 'Header Square' ) ) : '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/related.png" alt="' . get_the_title() . '" />';
$related .= '<li>' . $img . '<span class="related-heading">' . get_the_title() . '</span></li>';
after doing all this stuff i am still unable to see box-shadow, Actually shadow is there at its actual place but due to z-index i think i am unable to visible shadow.
please kindly help me to resolve the issue.
thank you.
After Solution:
The following code just show the image url in Genesis.
genesis_get_image( array( 'format' => 'url' ) );
Try something like this
http://jsfiddle.net/esnLn/
Set the image as div background
Your shadow is on the list item which has an inset shadow, and the image in the list item covers it. One way around this is to set the list item backround image to your image and remove the image itself.
Based on your update you can try this:
$img = genesis_get_image( array( 'size' => 'Header Square' ) );
$related .= '<li style="background-image:url('.$img.')"><span class="related-heading">' . get_the_title() . '</span></li>';