display text and button in proper positions using css - html

visit link1 , Its fine. But visit link2 Some problems are there
1)in 2nd link, there is huge gap b/w Rs 25 & "Selling Price + Rs 10 Delivery", Add to cart & buy now button.
2)Also only text "off" is visible, "50" went inside the "check delivery availability" box. 50 & off should visible
we are using this code :
.wk_mp_design .sell_price { display: none;}
.wk_mp_design .label.yousave_label {display: none;}
.wk_mp_design .old-price .price {color: #a0a0a0;font-size: 12px;font-weight: bold;}
.wk_mp_design .you_save_price {color: green;font-size: 11px;font-weight: bold;}
.wk_mp_design .you_save_price::after {content: "OFF";}
.wk_mp_design .special-price .price {color: #000;font-size: 13px;font-weight: bold;}
.wk_mp_design .regular-price .price {color: #000;font-size: 13px;font-weight: bold;}
.wk_mp_design .special-price {border-top: 1px dotted #ccc;clear: both;}
.wk_mp_design .You_savee {float: right;position: relative;top: -49px;}
.wk_mp_design .You_savee .special-price.yousave {border: medium none;}
.wk_mp_design .desc.std {border-top: 1px dotted #ccc;}
.wk_mp_design .mrp {display: none;}

1> height is the issue; use this
.product-view .product-essential .product-shop .price-box {
padding-bottom: 0 !important;
height: 75px;
}
2> top value is the issue; use this
.Quick .You_savee {
border: 1px solid #ccc;
border-radius: 37px;
color: green;
left: 151px;
padding: 0;
position: relative !important;
top: -70px !important;
width: 49px;
}
if above classes are used in multiple places just override these classes

1) Caused because of
<p class="special-price">
p elements 's margin-top
.Quick .special-price {
margin-bottom: 0px !important;
margin-top: 20px !important;
}
also notice the height in
.product-shop .price-box {
padding-bottom: 0px !important;
height: 100px;
}
aswell.
2) I don't really understand what you mean.

This is the relevant markup for the first site:
<div class="Quick_1">
<div class="product-data">
<div class="widget widget-static-block"></div>
<div class="price-box">
<p class="old-price">…</p>
<p class="special-price">…</p>
<p class="sell_price">…</p>
<p></p>
<div class="You_savee">…</div>
</div>
<div class="widget widget-static-block"></div>
</div>
<div class="add-to-box">…</div>
</div>
And this is the same part on the second site:
<div class="Quick_1">
<div class="product-data">
<div class="widget widget-static-block"></div>
<div class="price-box">
<p class="old-price">…</p>
<p class="special-price">…</p>
<div class="You_savee">…</div>
</div>
<div class="widget widget-static-block"></div>
</div>
<p class="sell_price">…</p>
<div class="add-to-box">…</div>
</div>
If you look closely, the sell_price element is outside of the product-data element in the second link which causes this problem. If you move it inside, above the You_savee within the price-box, then it will render as desired.

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

Changing line height without affecting the background color

I'm currently working on freecodecamp's first test, so my question is probably dumb. I would like to change the line-height of #titles to a smaller one, while keeping it's background color. It's probably the display element, but I can't figure out what to do. Also, I'd like to get rid of the white line surrounding my image, right before the border...
<div id="main">
<div id="titles">
<h1 id="title">A tribute to Ocelote</h1>
<h2 id="title2">The man who has done it all.</h2>
</div>
<hr>
<div id="img-div">
<img id="image" src="https://theshotcaller.net/wp-content/uploads/2017/09/IMG_5488-1.jpg" alt="A photo of Ocelote">
<div id="img-caption"> A story of how far can one go, if only the desire is
there.
</div>
<div id="tribute-info">
<br>
<br>
fgj
</div>
<a id="tribute-link" href="https://lol.gamepedia.com/Ocelote" target="_blank"> </a>
</div>
</div>
https://jsfiddle.net/deffciu/hrna0Lfs/
any help is appreciated
Adding the below two rules to #titles makes it work:
#titles {
display: block;
background: #6C7E95;
line-height: 5px;
/* Add the below two rules */
overflow: hidden;
padding: 0 0 20px;
}
You get this:
Snippet
html, body {
font-family: 'Oswald', sans-serif;
text-align: center;
background: white;
}
#title2 {
color: #052449;
margin-bottom: 0px;
}
#titles {
display: block;
background: #6C7E95;
line-height: 5px;
/* Add the below two rules */
overflow: hidden;
padding: 0 0 20px;
}
#image {
border: 8px solid #052449;
border-radius: 50%;
width: 500px;
height: 375px;
margin-top: 15px;
}
hr {
border-color: #486282;
margin-top:0px;
}
#img-caption {
margin-top: 20px;
font-style: italic;
font-size: 25px;;
}
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<link href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet">
<div id="main">
<div id="titles">
<h1 id="title">A tribute to Ocelote</h1>
<h2 id="title2">The man who has done it all.</h2>
</div>
<hr>
<div id="img-div">
<img id="image" src="https://theshotcaller.net/wp-content/uploads/2017/09/IMG_5488-1.jpg" alt="A photo of Ocelote">
<div id="img-caption"> A story of how far can one go, if only the desire is there.
</div>
<div id="tribute-info">
<br>
<br>
fgj
</div>
<a id="tribute-link" href="https://lol.gamepedia.com/Ocelote" target="_blank"> </a>
</div>
</div>
For the white border issue, it's your body's margins. The below code will fix it.
body {margin: 0;}

Add Text on Border

So I have an image and some text inside a border. I'm trying to have a word on the border itself and I can't seem to find a way of doing it.
my HTML
<div class="img">
<img src="https://imagizer.imageshack.us/v2/321x396q90/661/oUF8n3.jpg" align="left" height=400px width=400px alt="sliced">
<div class="text">
Calibre: From 1 up to 5 mm <br>
Packing: jute or polypropylene bags , Vacuum & Carton <br>
Usage areas: It is used as the raw material for processed and fully processed hazelnuts, etc. <br>
</div>
<h2> Sliced </h2>
</div>
CSS
.img {
float: left;
border-style: solid;
border-width: 2px;
border-color: 24AB36;
padding: 20px;
}
I want the header 2 to be on the border.
How do I do this ?
if you want a text on the border ,you can use fieldset
SEE DEMO
<fieldset>
<legend>Title Text</legend>
CONTENT HERE
</fieldset>
Html:
<fieldset class="field_set">
<legend style="text-align: center;"><h2>Sliced</h2></legend>
<div class="img">
<img src="https://imagizer.imageshack.us/v2/321x396q90/661/oUF8n3.jpg" align="left" height=400px width=400px alt="sliced">
<div class="text">
Calibre: From 1 up to 5 mm <br>
Packing: jute or polypropylene bags , Vacuum & Carton <br>
Usage areas: It is used as the raw material for processed and fully processed hazelnuts, etc. <br>
</div>
</div>
</fieldset>
CSS:
.img {
float: left;
padding: 20px;
}
.field_set{
border-width:6px;
border-color:#F00;
border-style: solid;
}
I can't see how the text could fit into your div's 2px border, so I assume you mean the padding.
In that case, set .img's position to relative, set h2's position to absolute, and use some guesswork to manoeuvre it into the padding using top and left properties.
http://jsfiddle.net/prashanthcr/p2zmc4o5/1/
.img {
<other properties omitted for brevity>
position: relative;
}
h2 {
position: absolute;
top: 395px;
left: 180px;
}
Fieldset may work, but the fieldset tag is usually used within a form to group controls/input elements, like a group of checkboxes.
It may be a little more semantically correct to just style and position your h2 like so:
body {
padding: 20px;
}
.img {
float: left;
border-style: solid;
border-width: 2px;
border-color: 24AB36;
padding: 20px;
position: relative;
}
.img h2 {
position: absolute;
background: white;
top: -1.65em;
}
<div class="img">
<h2> Sliced </h2>
<img src="https://imagizer.imageshack.us/v2/321x396q90/661/oUF8n3.jpg" align="left" height=400px width=400px alt="sliced">
<div class="text">
Calibre: From 1 up to 5 mm
<br>Packing: jute or polypropylene bags , Vacuum & Carton
<br>Usage areas: It is used as the raw material for processed and fully processed hazelnuts, etc.
<br>
</div>
</div>
Or if you're not as concerned about, semantics you could use a pseudo element like so:
.img::before {
content: "Sliced";
font-size: 2em;
position: absolute;
background: white;
top: -0.75em;
left: 0.75em;
}
body {
padding: 20px;
}
.img {
float: left;
border-style: solid;
border-width: 2px;
border-color: 24AB36;
padding: 20px;
position: relative;
}
.img::before {
content: "Sliced";
font-size: 2em;
position: absolute;
background: white;
top: -0.75em;
left: 0.75em;
}
<div class="img">
<img src="https://imagizer.imageshack.us/v2/321x396q90/661/oUF8n3.jpg" align="left" height=400px width=400px alt="sliced">
<div class="text">
Calibre: From 1 up to 5 mm
<br>Packing: jute or polypropylene bags , Vacuum & Carton
<br>Usage areas: It is used as the raw material for processed and fully processed hazelnuts, etc.
<br>
</div>
</div>

Select first DIV to remove its double border

Hi I'm trying to find a way to skip the first element that are dynamically generated (div class="Title") within the (div class="MyList") class. I've tried with :first-child and :first-of-type but no luck. Basically, I'm trying to remove the double border for the first Title element. Your help would be greatly appreciated!
HTML
<div class="MyList">
<div class="Title">
<h3></h3>
</div>
<div class="List"></div>
<div class="List"></div>
<div class="List"></div>
<div class="List"></div>
<div class="Title">
<h3></h3>
</div>
<div class="List"></div>
<div class="List"></div>
</div>
CSS
.MyList > :first-child{
border-top:none;
}
.Title {
text-align: center;
border-left-width:15px;
border-bottom-width:5px;
border-top: 3px solid black;
padding-top: 1px;
}
.Title:before {
content: '';
border-top: 1px solid black;
display: block;
width: 100%;
}
.Title h3 { padding: 20px;}
Check out this fiddle: http://jsfiddle.net/j2QLY/
You need to also override the :before code you are applying to the Title element:
.MyList > :first-child {
border-top:none;
}
.MyList > :first-child:before {
border-top: none;
}

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: