- This topic has 17 replies, 3 voices, and was last updated 4 years, 1 month ago by David.
-
AuthorPosts
-
March 13, 2020 at 10:03 am #1194061Pedro
Hello! I currently use Gutenberg to design the pages on my site.
I would like you to help me customize a section that I am doing.
I am trying to put a header (h2) before showing some products.
I would like after the title to put a “See More” link that redirects to a new page.
Something like Amazon does: https://mega.nz/#!q09lALJI!QWvUScWit6yDevjIlJ-wEOtW3TpVuJXwAEknyyoowjU
If you notice, just after the header they put the link the way I want to do it.
The point is, I don’t know how I can do it.
Can you help me? Thank you!!
March 13, 2020 at 5:21 pm #1194257DavidStaffCustomer SupportHi there,
try this:
1. Add this CSS to your site:
.linked-heading, .linked-heading + p { display: inline-block; } .linked-heading + p { margin-left: 2ch; }
2. In the Block editor add a H2 Heading Block, followed by a text block to contain your link.
3. Select the Heading Block, on the Settings Sidebar > Advanced -> Additional CSS Class add:
linked-heading
March 13, 2020 at 6:06 pm #1194278PedroHello david! It worked perfectly, you are the best !!
However, I notice that by adding all this, the space between the header and the products is reduced.
I don’t want this to happen.
Can you help me?
Thank you!
March 14, 2020 at 4:11 am #1194487DavidStaffCustomer SupportMade a slight adjustment to the CSS here – try that 🙂
March 14, 2020 at 4:32 am #1194503PedroHey David! You are a magician, I pay you my respects.
The fix worked perfectly.
Thank you!
March 14, 2020 at 4:38 am #1194511DavidStaffCustomer SupportYou’re welcome
March 14, 2020 at 4:41 am #1194515PedroUpdate: With the new CSS now the link “See more” is ALWAYS placed a line under the heading if it is very long (in the mobile version)
Even if there is space to appear on the second line of the header.
Here’s a screenshot: https://mega.nz/#!X8FlHA4K!2U2-_i3W0-ZXn_Aq1gSfoN3131hHc03p6WOMWXkW50c
March 14, 2020 at 4:49 am #1194521DavidStaffCustomer SupportTry this CSS:
@media (max-width: 768px) { .linked-heading { max-width: 70%; float: left; } }
March 14, 2020 at 5:12 am #1194542PedroHello David! I have added the new CSS and what I get with this is that the header is clipped for each line which leaves room for the link.
Here’s a screenshot: https://mega.nz/#!DgUAnIyJ!wpiSmMCaXBI5O9QT-AwI_b_ueTD4Ra8vApBxQI076zg
What I really want is for the link to just stick to the end of the last word in the header if it has space.
Something more or less like this: https://mega.nz/#!GkFQGYha!izfN91Nxaremc0ATyS4dYWRTxJPbcAGdtSjaCgNYHKM
March 14, 2020 at 5:20 am #1194545DavidStaffCustomer SupportOK so remove the CSS and remove the text block containing your link.
Edit your Heading and include the text for your link at the very end, highlight it and select the link option in the tool bar.
Then add this CSS:
.linked-heading a { font-size: 16px; margin-left: 2ch; }
Adjust the font-size and space accordingly.
March 14, 2020 at 7:15 pm #1195109PedroHello David! It worked exactly as I wanted, you are the best !!
Thank you.
March 15, 2020 at 4:03 am #1195280DavidStaffCustomer SupportGlad to be of help
March 15, 2020 at 10:51 am #1195686PedroHello David! Sorry to be a bother, I am telling you that the latest code works for most mobile devices.
There is no problem for the desktop version.
However for small screens like iPhone 5 or 6, customization doesn’t look very good.
Here you can see them:
iPhone 5: https://mega.nz/#!788liABK!mUsoFVAcWatb5ACuUKYaUl2m1p8EjN98gEfV1lE_8jQ
iPhone 6: https://mega.nz/#!ax0lUCiJ!1RhznhS8f0NS5Ozg0S5H7l_fE4XJunaL4FIVK9nQGRsWhat occurred to me then is to do the above customization, which ALWAYS showed the link on the right side and if the header was too long I divided it into 2 lines.
I am talking about this code:
@media (max-width: 768px) { .linked-heading { max-width: 70%; float: left; } }
It looked like this: https://mega.nz/#!DgUAnIyJ!wpiSmMCaXBI5O9QT-AwI_b_ueTD4Ra8vApBxQI076zg
What could be done from that code would simply be showing the link on the right side, but that it was aligned to the margin of the site.
In other words, it would look like this: https://mega.nz/#!CxtlHITT!hoxwaQF-56drX25hMkkd0w8Xy3ikpkJRLUfKxiRTFoM
The other option is that if the header is too long, and the link is affected, have the last word before the header go to a second line along with the link.
¿Can you help me, David?
March 15, 2020 at 7:09 pm #1195908TomLead DeveloperLead DeveloperHey Pedro,
What would you want it to look like, exactly? Would the title having a max-width with the link being next to the title (not all the way to the right) work better?
March 16, 2020 at 8:51 am #1196527PedroHello Tom! Thanks for answering.
I consider that the easiest and most successful option is the one you suggest.
Can you help me with this?
-
AuthorPosts
- You must be logged in to reply to this topic.