Putting Image and Text Next to Each Other - html

I've looked through some of the posts on this site in regards to my question, but I seem to be encountering problems while using the solutions.
Here's my HTML:
<div align="left"><div id="imgleft"><img src="tradecurrencymain.png" /></div></div>
<p>There's two different trade types: a market order and a limit order.</p>
<p>A market order allows a trade to be excuted immediately using the current trading ratio; 16 tokens equals 1 coin and 1 coin equals 15 tokens. A limit order gives you more cotrol; you can choose how much coins/tokens you will receive. For example, you may want to trade 100 tokens for 95 coins - someone has to accept the trade though.</p>
Here's my CSS:
#imgleft {
margin-right: 30px;
margin-left: 30px;
If someone could explain how to get an image and text directly next to each other, it would be highly appreciated.

Link to JSFIDDLE.
I wrapped everything in a wrapper (wrapper) and then floated 'imgleft' left. Here's the code:
HTML
<div class="imgWrap" align="left">
<div id="imgleft">
<img src="https://t2.ftcdn.net/jpg/00/31/93/43/400_F_31934352_QzlwTKN58UqGWtVEaSBvgOPqvfYxrIb7.jpg" />
</div>
<p>There's two different trade types: a market order and a limit order.</p>
<p>A market order allows a trade to be excuted immediately using the current trading ratio; 16 tokens equals 1 coin and 1 coin equals 15 tokens. A limit order gives you more cotrol; you can choose how much coins/tokens you will receive. For example, you may want to trade 100 tokens for 95 coins - someone has to accept the trade though.</p>
CSS
#imgleft {
float: left;
margin-right: 30px;
margin-left: 30px;
}

You may put the text-align attribute inside the img tag:
<img align="left" src="tradecurrencymain.jpg" style="margin-right:30px;margin-left:30px;" />
<p>There's two different trade types: a market order and a limit order.</p>
<p>A market order allows a trade to be excuted immediately using the current trading ratio; 16 tokens equals 1 coin and 1 coin equals 15 tokens. A limit order gives you more cotrol; you can choose how much coins/tokens you will receive. For example, you may want to trade 100 tokens for 95 coins - someone has to accept the trade though.</p>

Related

How to remove tags and page numbers from txt files?

I have some txt files and I would like to remove tags and page nums from them. My txt file looks like this:
txtfile = """
<Header>
header contents
</Header>
The following discussion should be read in conjunction with our financial statement.
1
The interest rate charged on loans is subject to the regulation
2
of the Small Business Administration.
3
We are able to charge the maximum rate on certain commercial loans.
<EX-2.1>
abc
</EX-2.1>
<EX-12.1>
def
</EX-12.1>
"""
I would like to remove tags <Header and <EX-num.num> and also its contents. I tried to use
cleantext = BeautifulSoup(txtfile, "lxml").text
, but it only removed tags and preserve contents in the tags. Is there any way to remove both tags and its contents?
I also need to remove the page nums, there are 3 types of page numbers:
pagenum + \n (like above page 1)
pagenum + \n (page 2, in this case, one paragraph is divided into 2 parts by page number, and I hope to combine them into one paragraph)
\n + pagenum + \n (page 3)
So the text may look like finally
txtfile = """
The following discussion should be read in conjunction with our financial statement.
The interest rate charged on loans is subject to the regulation of the Small Business Administration.
We are able to charge the maximum rate on certain commercial loans.
"""
Is there any way to realize that? Thanks!
To remove the tags you could go with decompose:
for e in soup.find_all(text=False):
e.decompose()
Removing the line breaks may use regex:
re.sub(r'(\d\n\s+)|(?<=[^\.])\n','',soup.text.strip())
Example
from bs4 import BeautifulSoup
import re
html = '''
<Header>
header contents
</Header>
The following discussion should be read in conjunction with our financial statement.
1
The interest rate charged on loans is subject to the regulation
2
of the Small Business Administration.
3
We are able to charge the maximum rate on certain commercial loans.
<EX-2.1>
abc
</EX-2.1>
<EX-12.1>
def
</EX-12.1>'''
soup = BeautifulSoup(html, 'html.parser')
for e in soup.find_all(text=False):
e.decompose()
re.sub(r'(\d\n\s+)|(?<=[^\.])\n','',soup.text.strip())
Output
The following discussion should be read in conjunction with our financial statement.\nThe interest rate charged on loans is subject to the regulationof the Small Business Administration.\n We are able to charge the maximum rate on certain commercial loans.

Google rejecting Facebooks json-ld required tags

I am setting up JSON+LD tags on my product pages for Facebooks "Dynamic Ads & Commerce".
https://developers.facebook.com/docs/marketing-api/catalog/reference/
Two tags it states are required:
id
Required for dynamic ads and commerce.
availability
Required for dynamic ads and commerce.
I've added these, but it causes Google to reject my json+ld markup.
Invalid enum value in field 'availability'
1.
2.
How could I please both parties here? If I am adding json+ld markup, it may as well have all required elements to be valid on Google and Facebook (Catalog).
[
{
"#context":"http:\/\/www.schema.org",
"#type":"Product",
"name":"Silentnight Safe Nights Toddler Bedset – 4.5 Tog",
"title":"Silentnight Safe Nights Toddler Bedset – 4.5 Tog",
"url":"http:\/\/myexampledomain.co.uk\/product\/silentnight-safe-nights-toddler-bedset-4-5-tog\/",
"link":"http:\/\/myexampledomain.co.uk\/product\/silentnight-safe-nights-toddler-bedset-4-5-tog\/",
"image":"http:\/\/myexampledomain.co.uk\/app\/uploads\/sites\/3\/2019\/10\/silentnight-safe-nights-toddler-bedset-4.5-tog-pack.jpg",
"image_link":"http:\/\/myexampledomain.co.uk\/app\/uploads\/sites\/3\/2019\/10\/silentnight-safe-nights-toddler-bedset-4.5-tog-pack.jpg",
"description":"The Silentnight Toddler Duvet and Pillow set makes a great first bed set for your little one. The cot bed sized set includes a snuggly duvet and a soft pillow that is specially designed for children. The slim profile of the pillow offers your child just the right amount of support they need. It's important that small children don't overheat in bed, so the light and soft duvet comes in a 4.5 tog weight rating. Both the pillow and duvet are made from a smooth polycotton cover offering breathable comfort. The products are filled with anti-allergy hollowfibre that actively defends against the bacteria and dust mites that can cause allergies providing a cleaner, fresher and altogether a safer option for a good night's sleep. Our anti-allergy fibres are approved by the British Allergy Foundation, which means they have the ultimate seal of approval. Our fibres have been scientifically tested and are proven to reduce or remove allergens from the indoor environment.\nSuitable only for children over 12 months. Both the pillow and duvet are fully machine washable, and thanks to the easy care polycotton covers, the products have great recovery and can be washed time and time again.",
"sku":"506984LS",
"id":17214,
"productID":17214,
"offers":[
{
"#type":"Offer",
"price":"30.99",
"priceCurrency":"GBP",
"url":"http:\/\/myexampledomain.co.uk\/product\/silentnight-safe-nights-toddler-bedset-4-5-tog\/",
"gtin":"5012701506984",
"gtin8":"5012701506984",
"condition":"new",
"availability":"in stock",
"inventoryLevel":54
}
],
"brand":"Silentnight"
}
]

space is not showing in html

I don't know whether it is a basic question, but I need to ask.
Here is my problem. when a wrote a simple HTML code for showing a paragraph,
but its not getting in the correct format that i wish.
I am adding code below.
<p>
Eosinophil count - absolute
An absolute eosinophil count is a blood test that measures the number of white blood cells called eosinophils.
Eosinophils become active when you have certain allergic diseases, infections, and other medical conditions.
How the Test is Performed
Most of the time blood is drawn from a vein on the inside of the elbow or the back of the hand. The site is cleaned with an antiseptic.
The health care provider wraps an elastic band around your upper arm to make the vein swell with blood.
Next, the provider gently inserts a needle into the vein. The blood collects into an airtight tube attached to the needle.
The elastic band is removed from your arm. The needle is then removed and the site is covered to stop bleeding.
Things to Know
In infants or young children, a sharp tool called a lancet may be used to prick the skin.
The blood collects in a small glass tube, or onto a slide or test strip. A bandage is put on the spot to stop bleeding.
Reference Range
The serum reference ranges of eosinophils are as follows:
Eosinophils blood (%): 0.0-6.0 (This range may vary slightly in different laboratories.)
Eosinophil blood count (absolute): 30-350. The percentage of eosinophils is multiplied by the white blood cell count to
give the absolute eosinophil count. This range may vary slightly in different laboratories.
ANTIGEN SUSPENSION SERUM DILUTION
. 1:30 1:60 1:120 1:240
--------------------------------------------------------------------------------
Salmonella Typhi "O" : -- -- -- --
Salmonella Typhi "H" : -- -- -- --
Salmonella Para Typhi "AH" : -- -- -- --
Salmonella Para Typhi "BH" : -- -- -- --
</p>
But in output all the spaces are truncated.
How to get the exact text as output?
Check white-space: pre; property in css here
p {
white-space: pre;
}
<p>
Eosinophil count - absolute
An absolute eosinophil count is a blood test that measures the number of white blood cells called eosinophils.
Eosinophils become active when you have certain allergic diseases, infections, and other medical conditions.
How the Test is Performed
Most of the time blood is drawn from a vein on the inside of the elbow or the back of the hand. The site is cleaned with an antiseptic.
The health care provider wraps an elastic band around your upper arm to make the vein swell with blood.
Next, the provider gently inserts a needle into the vein. The blood collects into an airtight tube attached to the needle.
The elastic band is removed from your arm. The needle is then removed and the site is covered to stop bleeding.
Things to Know
In infants or young children, a sharp tool called a lancet may be used to prick the skin.
The blood collects in a small glass tube, or onto a slide or test strip. A bandage is put on the spot to stop bleeding.
Reference Range
The serum reference ranges of eosinophils are as follows:
Eosinophils blood (%): 0.0-6.0 (This range may vary slightly in different laboratories.)
Eosinophil blood count (absolute): 30-350. The percentage of eosinophils is multiplied by the white blood cell count to
give the absolute eosinophil count. This range may vary slightly in different laboratories.
ANTIGEN SUSPENSION SERUM DILUTION
. 1:30 1:60 1:120 1:240
--------------------------------------------------------------------------------
Salmonella Typhi "O" : -- -- -- --
Salmonella Typhi "H" : -- -- -- --
Salmonella Para Typhi "AH" : -- -- -- --
Salmonella Para Typhi "BH" : -- -- -- --
</p>
use &nbsp for space in HTML
In HTML, multiple spaces are automatically replaced by only one space except if your text is surrounded with <pre> tag.
If you want your spaces in another type of tag (e.g. <p>) you need to use HTML entities. The HTML entity for a normal space is and for a tab character it's &tab;. There's a lot of HTML entities like those. Here is a good reference to find the HTML entities you need: HTML entities reference chart

in rails erb file i want to display an output as a decimal only at one place where actually it is showing as a float value

<div class='summary' align="justify" style='vertical-align: top;'>
<div>
{{:stats.tot_fte}} Employees Assigned
  {{:stats.tot_fte_effort}} Total Effort
</div>
<div>
{{:stats.tot_users}} Users Assigned
    {{:stats.tot_user_effort}} Total Effort
</div>
</div>
this is the code which i wrote to display total effort as output where i calculate total effort at some other place,where it should always be float value as i use it for other calculations.But while displaying this here i want it to be a decimal value with two numbers after the decimal.please help me in completing this as i am a beginner.
The output is as follows,
340 Employees Assigned   340.89666666666665 Total Effort
453 Users Assigned     452.6066666666666 Total Effort
i want the total effort display as a decimal value only here.
Since you are using Rails, it comes with a numbers helper in ActionView. You can use number_with_precision(number, options = {}).
For example:
number_with_precision 123.456, precision: 2
Old School:
sprintf('%.2f', number)
Other:
(340.89666666666665).round(2)
Example:
{{:stats.tot_user_effort.round(2)}} Total Effort
{{sprintf('%.2f', :stats.tot_user_effort)}} Total Effort

Tumblr theme limitation

In my Tumblr, there is a "Likes" column on the right. I changed the number of displayed "liked" posts to 15 here:
<h3 class="section-title">{lang:Likes}</h3>
{Likes limit="15" width="200" summarize="200"}
but it doesn't display more than 5. The highest number it does display is 10. I want it to go all the way to the bottom, or as closest to that point as possible. Any idea how?
If you use the API, I believe you can get 20 likes: http://www.tumblr.com/docs/en/api/v2#blog-likes
If you want to get more, you will need to grab the first 20, then use offset to get 20 onwards.