Removing border from last div - html

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;
}

Related

How to select h4 heading

I'm trying to decrease my font size for a h4 header and change some other things but the h4 class, .awpcp-listing-title doesn't seem to function as a selector.
Tried several options, including important, like the code I have here:
.awpcp-listing-title {
font-size: 10px;
margin-right: 50px;
padding: 15px;
}
<div class="awpcp-listing-excerpt-inner" style="w">
<h4 class="awpcp-listing-title">Scarf</h4>
<div class="awpcp-listing-excerpt-content">Grey scarf</div>
</div>
<div class="awpcp-listing-excerpt-extra">
05/10/2019<br/>
.awpcp-listing-title {font-size: 10px !important;}
the !important is very "important" to make sure your CSS will be applied.
.awpcp-listing-title a
{
font-size: 10px!important;
margin-right: 50px;
padding:15px;
}
<div class="awpcp-listing-excerpt-inner" style="w">
<h4 class="awpcp-listing-title">Scarf</h4>
<div class="awpcp-listing-excerpt-content">Grey scarf</div>
</div>
<div class="awpcp-listing-excerpt-extra">
05/10/2019<br/>
Check and try this code
You really should not use !important as all the other answers suggest - you simply need to find the right selector and it is is NOT the h4 - its the a within it.
Simply put - browers render h4's with default styling, so first - clear that using the h4 element as the selector - then target its child - the a element.
I have styled it red to show that it is targetted.
h4 {
margin: 0;
padding: 0;
}
.awpcp-listing-title a {
font-size: 10px;
margin-right: 50px;
padding 15px;
color: red;
}
<div class="awpcp-listing-excerpt-inner" style="w">
<h4 class="awpcp-listing-title">
Scarf
</h4>
<div class="awpcp-listing-excerpt-content">Grey scarf</div>
</div>
<div class="awpcp-listing-excerpt-extra">
05/10/2019<br/>
h4.awpcp-listing-title{
font-size:20px !important;
}
<div class="awpcp-listing-excerpt-inner">
<h4 class="awpcp-listing-title">Scarf</h4>
<div class="awpcp-listing-excerpt-content">Grey scarf</div>
</div>
<div class="awpcp-listing-excerpt-extra">
05/10/2019<br/>
</div>
remove style="w" incorrect stansted code
The reason behind your code is not working is that you are using anchor tag and your css has no code to change that font-size.
.awpcp-listing-title a{
font-size: 10px;
margin-right: 50px;
padding : 15px;
}
<div class="awpcp-listing-excerpt-inner" style="w">
<h4 class="awpcp-listing-title">Scarf</h4>
<div class="awpcp-listing-excerpt-content">Grey scarf</div>
</div>
<div class="awpcp-listing-excerpt-extra">
05/10/2019<br/>
I have modified the CSS code slightly. No need to include the URL selector.
h4.awpcp-listing-title {
font-size: 10px!important;
margin-right: 50px;
padding: 15px;
}

How to not use absolute positioning CSS

I'm currently working on an old website that was created with some old crappy WYSIWYG editor. I'm new to web-dev and still trying to get my head around positioning elements properly. My current issue is, from what I have read, using absolute positioning is BAD, but how would you change this?
So this is the old code:
<div id="wb_Text1"
style="margin:0;
padding:0;
position:absolute;
left:187px;
top:24px;
width:83px;
height:147px;
text-align:left;
z-index:1;
border:0px #C0C0C0 solid;
overflow-y:hidden;
background-color:transparent;
">
<div style="font-family:'.Helvetica Neue DeskInterface';font-size:15px;color:#000000;">
<div style="text-align:left">
<span style="font-family:Arial;font-size:43px;color:#FFFFFF;">
<strong>W</strong>
</span>
</div>
<div style="text-align:left">
<span style="font-family:Arial;font-size:43px;color:#FFFFFF;">
<strong>A</strong>
</span>
</div>
<div style="text-align:left">
<span style="font-family:Arial;font-size:43px;color:#FFFFFF;">
<strong>C</strong>
</span>
</div>
</div>
And what I have come up with to replace it is:
HTML
<div class="logo-ul">
<ul>
<li>W</li>
<li>A</li>
<li>C</li>
</ul>
</div>
CSS
.logo-ul {
list-style-type: none;
color: white;
font-size: 2em;
z-index:24;
float: right;
margin-right: 80%;
}
Which looks fine until you collapse the window and it falls apart :( lol.
You can see what I'm doing here http://media.wacmotorcycles.co.uk/
How should I be writing this please?
Thanks.
Try changing #logo to
#logo {
max-width: 165px;
max-height: 171px;
margin: 0.75em 0;
float: left;
}
And, .logo-ul to
.logo-ul {
list-style-type: none;
color: white;
font-size: 2em;
z-index: 24;
float: left;
}
There is nothing inherently wrong with absolute positioning. If used incorrectly, it can have unexpected results when working with responsive layouts.
In your specific case, the W A C might be better implemented as part of the logo image itself rather than text. It's not offering any semantic or SEO benefit to include the letters in a list. Short of that, this is one way to implement what I think you're after:
.logo {
height: 6rem;
padding-left: 50px;
}
.logo-letter {
display: block;
height: 2rem;
}
<div class="logo">
<span class="logo-letter">W</span>
<span class="logo-letter">A</span>
<span class="logo-letter">C</span>
</div>

Make Headers clickable and display specific paragraphs when selected

I am trying to setup a horizontal bar with 3 clickable titles. Before being clicked they are one color but when selected I'm trying to get that section to change color and display a specific paragraph below the bar.
Here is a jfiddle of what I currently have..
<div class="storytelling_tabs" style="width:100%; background:#44c5e1; text-align:center;">
<h5 style="padding:3% 3% 3% 0px; display:inline-block;">Section<br>One</h5>
<h5 style="padding:3% 4%; display:inline-block; border-left:10px solid; border-right:10px solid;">Section<br> Two</h5>
<h5 style="padding:3% 0px 3% 3%; display:inline-block;">Section<br> Three</h5>
http://jsfiddle.net/9g9ybepy/1/
From what I have tried to gather online I might need to use a function of clickable(), but I'm not sure.
Hopefully there is a way to do this, thanks in advance.
You don't need Javascript, you can do this with css :target
http://www.w3schools.com/cssref/tryit.asp?filename=trycss3_target_tab
storytelling_tabs {
width: 100%;
background: #44c5e1;
text-align: center;
}
storytelling_tabs h5 {
color: #fff;
font-size: 0.9em;
}
.tab .showMe {
display: none;
}
.tab .showMe:target {
display: block;
}
<div class="tab">
<div class="storytelling_tabs" style="width:100%; background:#44c5e1; text-align:center;">
Section One
Section Two
Section Three
</div>
<div class="showMe" id="link1">
<p>Patagraph1</p>
</div>
<div class="showMe" id="link2">
<p>Patagraph2</p>
</div>
<div class="showMe" id="link3">
<p>Patagraph3</p>
</div>
</div>
To do that you need to use JavaScript. You need to create a function and "tell" to the html that your page will execute that function when your h5 is clicked.
Here the html:
<h5 style="padding:3% 3% 3% 0px; display:inline-block;" onClick="myFunction(this.id, idParagraph)">Section<br>One</h5>
Here is JavaScript function:
function sectionClick(idSection, idParagraph){
document.getElementById(idSection).css.backgroundColor = "blue";
document.getElementById(idParagraph).css.display = "block";
}

How can I customize answer posts in a theme based on the Minimal theme?

I want to customize the appearance of questions when they are in answer posts in my theme, which is based on the Minimal theme. I tried adding things from my previous template, which had asks formatted the way I want, but it didn't work.
Here's what I added:
A div with classes "question" and "bubble" around the {Question} element:
<div class="question bubble">
{Question}
</div>
CSS for the bubble:
.bubble {
color: #9f6f6f;
font-size: 13px;
line-height: 20px;
background: #f5f5f5;
border: 1px solid #d5d5d5;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
padding: 8px 12px;
position: relative;
display: block;
}
This looked right when I open just that HTML/CSS as a snippet, but it didn't seem to have any effect at all on the theme. Nothing changed when I added it.
Furthermore, I wasn't able to find a {Question} hiding anywhere already in the Minimal theme.
How can I customize my {Question} display?
{Question} is one of the blocks that doesn't work unless it's inside a top-level block, in this case {block:Answer}. There's an example on http://www.tumblr.com/docs/en/custom_themes:
{block:Answer}
<div class="question">
<div class="asker">{Asker}</div>
<div class="asker-question">{Question}</div>
<img class="asker-avatar" src="{AskerPortraitURL-96}" alt="">
</div>
{block:Answerer}
<div class="answer">
<div class="answerer">{Answerer}</div>
<div class="answerer-answer">{Answer}</div>
<img class="answerer-avatar" src="{AnswererPortraitURL-96}" alt="">
</div>
{/block:Answerer}
<div class="replies">
{Replies}
</div>
{/block:Answer}
...however this didn't do exactly what I wanted either. What I ended up doing was putting the following markup into my theme right after the line containing {/block:Text}:
{block:Answer}
<div class="bubble">
<div class="asker">{Asker}</div> asked: <div class="question">{Question}</div>
</div>
<div class="answer">
{Answer}
</div>
{/block:Answer}
and then adding this CSS at the bottom, just before the line containing {CustomCSS}:
/* Answer Posts */
.bubble {
color: #6f6f6f;
font-size: 13px;
line-height: 20px;
background: #f5f5f5;
border: 1px solid #d5d5d5;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
padding: 8px 12px;
position: relative;
display: block;
margin-bottom: 1em;
}
.asker {
display:inline;
font-weight:bold;
}
.question {
display:inline;
}
and for good measure I added {block:Answer}post-type-answer{/block:Answer} after {block:Audio}post-type-audio{/block:Audio} and {block:Answer}Answer{/block:Answer} after the audio block end as well, in the class name assignments for {block:Posts}.
and this gave me what I wanted:

The font is not being displayed at the bottom of the container?

This is my HTML code to display font with a background in a small container . .
here is the css
.cons_save h4{font:bold 22px/60px Arial,Helvetica, sans-serif;margin:20px 0px -15px 20px; color:#f78d1d;vertical-align: bottom; background:url(../images/save_bg_cons.png) no-repeat; width:151px; height:69px;}
im not able to put it ! in the bottom of that container whatever the other content above it in the container remains
My HTML CODE
<div id ="<?php echo $store->branch_id;?>Collect" style="display:block">
<span class="cons_save fl clr">
<h4><?php echo $save. " %"; ?> </h4>
</span>
</div>
First, I would write each property of the CSS separately as follows:
.cons_save h4 {
font-weight: bold;
font-size: 22px/60px;
font-family: Arial, Helvetica, sans-serif;
margin: 20px 0px -15px 20px;
color: #f78d1d;
vertical-align: bottom;
background: url(../images/save_bg_cons.png) no-repeat;
width: 151px;
height: 69px;
}
then, it seems that the class name does not match the one in the span tag.
You should actually try and set the class name in the header tag itself.
Don't put heading tags insides spans
<div id ="<?php echo $store->branch_id;?>Collect" style="display:block">
<div class="cons_save fl clr">
<h4><?php echo $save. " %"; ?> </h4>
</div>
</div>
And also heading having a lot of margin & padding by default. So might be the reason to come in the bottom. Be sure to clear it
.cons_save h4 { margin: 0;padding:0; }
It works without the reset too, check here
not sure what is the problem, if you could sepcify using http://jsfiddle.net/ then it would be nice.
anyway, i suggest you changing span to div, like this:
<div id ="<?php echo $store->branch_id;?>Collect" style="display:block">
<div class="cons_save fl clr">
<h4><?php echo $save. " %"; ?> </h4>
</div>
</div>
moreover, you have vertical-align which would not work, unless you add to your css display: table-cell [note: this will not work in IE7]:
.cons_save h4{display: table-cell;font:bold 22px/60px Arial,Helvetica, sans-serif;margin:20px 0px -15px 20px; color:#f78d1d;vertical-align: bottom; background:url(../images/save_bg_cons.png) no-repeat; width:151px; height:69px;}
I wouldn't recommend you to use that property (vertical-align) on block level elements. And don't put a heading inside a span.
Without changing the HTML I would do this:
#Collect{
border: 1px solid #ccc;
width: 151px;
height: 69px;
}
h4{
font-weight: bold;
font-size: 22px/60px;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
color: #f78d1d;
background: url(../images/save_bg_cons.png) no-repeat;
background:#eee;
position: absolute;
bottom: 0;
}​
You can even get rid of the span.