I know you can put link URLs directly after the link itself, but is there a way to do that at the bottom of the page instead?
If I have a page that looks like this:
<p>Check here and here for more information.</p>
I can use the CSS trick above to make the print version look like this:
Check here (http://example.com) and here (http://example.net) for more information.
Is there a way to make it look like this instead?
Check here[1] and here[2] for more information.
[1] http://example.com
[2] http://example.net
If you know the number of links you could achieve what you want. Let's assume there are three links in your section.
section {
counter-reset: links;
position: relative;
padding-bottom: 4em;
}
section a {
counter-increment: links;
}
section a::after {
content: "["counter(links)"]";
}
section a::before {
content: " ["counter(links)"] "attr(href);
position: absolute;
left: 0;
}
section a:nth-of-type(1)::before {
bottom: 2em;
}
section a:nth-of-type(2)::before {
bottom: 1em;
}
section a:nth-of-type(3)::before {
bottom: 0em;
}
<section>
Here's your text containing three links.
</section>
Note: In long texts on multiple pages you may get unexpected results. But you could devide your text in multiple sections. And of course your css code increases with every new link...
I personally would do it this way.
First create a hidden ul element at the bottom with an id.
<ul id="footnotes"></ul>
CSS
#footnotes {
list-style: none;
position: fixed;
bottom: 0;
display: none;
}
Then give all a elements on the page an index manually.
My link
My link
My link
Then show the footnotes element in print mode and attach its index behind.
#media print {
a:after {
content: "["attr(data-index)"]";
}
#footnotes {
display: block;
}
}
Now iterate in JavaScript through all a elements on the page and show the link for each index.
const footNotes = document.getElementById('footnotes');
const links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
var li = document.createElement('li');
li.innerHTML = '[' + links[i].getAttribute('data-index') + '] ' + links[i].getAttribute('href');
footNotes.appendChild(li);
}
Related
I have a bunch of html output that I receive like this
<div>
<h4>This</h4><p>Value 9.6 m.</p>
<h4>That</h4><p>Value 9.6 m.</p>
<h4>The other</h4><p>Another 7.69 m.</p>
<h4>And yet</h4><p>Another value 4.8 m.</p>
</div>
and I want to have it rendered something like this
This: Value 9.6 m.
That: Value 9.6 m.
The other: Another 7.69 m.
And yet: Another value 4.8 m.
I think it probably should have been created as a definition list, but i don't control the html generation.
I can get the first h4 p 'block' to render correctly with the following but I can't seem to get subsequent 'blocks' to render as desired.
h4:after {
content: ": ";
display: inline;
white-space: nowrap;
}
h4 {
display: block; }
h4~p {
display: block; }
h4:first-child {
display: inline;}
h4+p {
display: inline;
}
Any suggestions on how to achieve the desired output?
TIA
If you don't need a tidy column or grid layout for these, I found Ye Olde Floats worked best:
// normalize the spacing and stuff between the h4 and p
h4, p {
display: block;
line-height: 1.4;
padding: 0;
margin: 0;
}
h4 {
// honestly, this got the most sturdy result
float: left;
// add the colon and a little space
&:after {
content: ": ";
margin-right: 10px;
}
}
// break the line after each P
p {
&:after {
display: block;
clear: right;
content: "";
}
}
I also threw this into a CodePen.
Also if you would like a more tabular or column-y version, I had some luck with flexbox and css grid.
Hope this helps, happy coding!
AppSumo requires that the "Discount code" field be renamed "AppSumo Code". Without accessing the FTP, can I do this in the "customize CSS" section of my Wordpress site?
I also have to change the "Apply" text to "Redeem AppSumo Code".
Please help!
enter image description herehttps://www.molo9.com/my-account/membership-checkout/?level=4
I have tried
label.pp-discount-code {
visibility: hidden !important;
}
label.discount-code {
visibility: hidden !important;
}
.pp-discount-code {
visibility: hidden !important;
}
to hide the discount code label so that I could use
.pp-discount-code:before {
content: ‘Enter your AppSumo Redemption Code below’;
visibility:visible;
}
but none of this is working. Please advise.
Add a class to particular label
In the CSS: make font size 0 to this label to hide existing text and create a before sudoku element from CSS, in the before add the content whatever you wanted to display in place of a hidden label
Example:
Name
CSS:
label.hidetext {
font-size: 0;
position: relative;
}
label.hidetext:before {
content: "Full Name here";
position: absolute;
top: 0;
left: 16px;
width: 100%;
height: 20px;
font-size: 20px;
}
So I am a bit stumped on this ... I'm using a WebView in a portion of our app, the reason for the WebView is because we are pulling from an API endpoint that returns to us an HTML string. The font size and other things in this HTML string aren't styled for the purpose of using in a mobile app so we are trying to add some stylistic changes to it for better viewability. I've seen people add Style Tags at the top of the html file to add specific html styles to the element, and everything is generally working except the font size in the HTML of WebView renders differently every time I click into the screen that has the WebView contained in it.
Here is the current code (style + html + script):
let rawHTML = htmlStyle + this.props.itemDetails.body_html.replace("\n", "").replace(/("\/\/[c])\w/g, "\"https://cd").replace(/(width: 10.094%;)/g, "").replace(/(width: 84.906%;)/g, "") + heightScript
I have also console logged this string out in the debugger to make sure it's stitched well, and have even created and index.html and pasted in there the exact string, to make sure it's just showing up properly there.
Here is the style string:
let htmlStyle = `<style>
#height-calculator {
margin: 0;
padding: 0;
}
#height-calculator {
position: absolute;
top: 0;
left: 0;
right: 0;
margin: 0;
padding: 0;
}
body {
width:100%;
}
h2 {
font-size: 48px;
}
p {
font-size: 18px;
}
h3 {
font-size: 32px
}
img {
width:98%;
}
td {
display: block !important;
width: 95% !important;
}
img {
width:98%;
}
hr {
width: 98%;
}
ol li ol li ol li {
position: relative; right: 85px;
}
ul {
width: 98%,
margin-left: -25px;
}
li {
width: 98%;
}
.tabs {
display: none;
}
.tabs > li {
display: none;
}
.tabs-content {
padding: 0;
list-style-type: none;
}
tr {
display: flex;
flex-direction: column;
}
</style>`
And finally here is the WebView:
<WebView
javaScriptEnabled={true}
onNavigationStateChange={this.onNavigationStateChange.bind(this)}
scrollEnabled={false}
source={{html: rawHTML}}
style={{height: Number(this.state.height)}}
domStorageEnabled={true}
scalesPageToFit={true}
decelerationRate="normal"
javaScriptEnabledAndroid={true} />
Also, as I mentioned all the other styles applied are working, it's mainly just the font size that is super unpredictable.
Here is the view when I click it one time:
And then I don't change or exit the app, I just go back, and then click the same button to enter that same display and I get this sometimes (it sometimes takes multiple clicks ... it's very unpredictable):
I have a video of this as well, if you feel that would help this explanation. I'm trying to retell it the best I can haha.
Edit:
I think this might be a simulator only related issue? If anyone could speak some wisdom into that, that would be awesome still. I can't seem to reproduce this error on production build.
I recently experienced the same issue. It was only occurring for me on iOS, not Android.
The weirdest part is the inconsistency in replication. I couldn't find any pattern to when the WebView content would be sized differently. Identical HTML would result in font size that was sometimes normal, but other times very tiny.
My solution came from a (RN 0.47) WebView prop:
scalesPageToFit?: bool
Boolean that controls whether the web content is scaled to fit the view and enables the user to change the scale. The default value is true.
I tried setting scalesPageToFit to false, and voilà, the page stopped scaling down:
<WebView
source={{ html: myHtml }}
scalesPageToFit={false}
/>
The only problem is that this caused my content to be scaled larger than the WebView's container on Android. To fix this, I simply set the scalesPageToFit prop conditionally, based on platform:
<WebView
source={{ html: myHtml }}
scalesPageToFit={(Platform.OS === 'ios') ? false : true}
/>
Worked like a charm for me!
I used react-native-render-html. The reason I choose this solution over the accepted answer is because I can style html tags using react native styles instead of injecting style declaration string before the actual content.
const htmlStyles = { p: {fontFamily: 'Lato'} }
const htmlContent = <H1>My Html</H1>;
<HTML containerStyle={ {margin: 16} }
html={ htmlContent }
tagsStyles={ htmlStyles } />
On this site in the search in the header I can't click the top two AJAX search results because I think they are under another layer. (Search for: condo). I have tried messing with the z-index. I changed the background color of the header to be able to see the top two search results. Here's what I put in the child CSS:
.fusion-sticky-header-wrapper {
display: block;
position: relative;
z-index: 2;
}
.fusion-header-v2 .fusion-header, .fusion-header-v3 .fusion-header,
.fusion-header-v4 .fusion-header, .fusion-header-v5 .fusion-header {
display: block;
background-color: rgba(255,255,255,0);
position: relative;
z-index: 1;
}
.search-in-place, .item {
z-index: 10000;
}
Same results with other plugins so I know it must be in the site CSS, right? Any help appreciated.
The header bar is over the search results because of this declaration:
.fusion-header-wrapper {
position: relative;
z-index: 10010;
}
To solve this you would need to remove the z-index declaration from the header wrapper or set the z-index for the search results higher than 10010, for example:
.search-in-place, .item {
z-index: 10020;
}
http://forumgallery.rollinleonard.com/artists.php
I can't seem to get rid of the space before the comma in my list.
It makes no sense!
Here is the relevant part of my CSS
.artistlist {
margin: 0px;
padding: 0;
}
li.artistlist {
display: inline;
margin: 0;
padding: 0;
font-size: .75em;
line-height: 1.5em;
word-spacing: 1px;
}
li.artistlist:after {
content:", ";
}
.artistlist li:last-child:after {
content:"";
}
ul li{
margin:0;
}
I did a small demo with less CSS code that renders without a whitespace before the comma. Tested in Chrome and Firefox on Mac.
Looked at your updated page and found the problem with it. Read more about possible whitespace bugs within different browsers here: http://www.42inc.com/~estephen/htmlner/whitespacebugs.html
Your html looks like this:
<li class="artistlist">
Davis Cone
</li>
Try to remove the whitespace between your tags and it renders fine:
<li class="artistlist">Davis Cone</li>
For special chars like space you should use Unicode in the content. Try this:
li.artistlist:after {
content:",\00a0";
}