- This topic has 15 replies, 3 voices, and was last updated 4 years, 3 months ago by Amit.
-
AuthorPosts
-
January 22, 2020 at 7:11 am #1140400Amit
Hi, I am willing to add some solid color background, an image to the left and text into the right side with Category title, something like homegrounds.co/coffee-recipes/. How can I do this?
January 22, 2020 at 7:24 am #1140417LeoStaffCustomer SupportHi there,
You’d need to create a header element:
https://docs.generatepress.com/article/header-element-overview/The basic structure would be this:
<div class="hero-columns"> <div class="hero-column-1"> image here </div> <div class="hero-column-2"> text-here </div> </div>
and CSS:
.hero-columns { display: flex; } .hero-columns > div { width: 50%; } @media (max-width: 768px) { .header-section > div { width: 100%; } }
A second option would be to use background image like this:
https://docs.generatepress.com/article/page-hero-examples/#example-3Let me know if this helps ๐
January 23, 2020 at 3:00 am #1141163AmitBut that’s the category and not a page!
January 23, 2020 at 5:19 am #1141284DavidStaffCustomer SupportHi there,
the method that Leo provides works for Page, Post or Archive ( Category ).
You just need to select the Category Archive you want in the Header Elements > Display RulesJanuary 24, 2020 at 2:51 am #1142341AmitWhat will the code for adding image? Should I have to upload the image first into my cpanel?
January 24, 2020 at 5:43 am #1142472DavidStaffCustomer SupportSo you’re code will look like this:
<div class="hero-columns"> <div class="hero-column-1"> <img src="add_the_full_URL_to_image_here" alt="Alt Text" width="400" height="400"> </div> <div class="hero-column-2"> text-here </div> </div>
Simply add the image to your Media library, select the image and get its URL, then add the URL to this line of the above code:
<img src="add_the_full_URL_to_image_here" alt="Alt Text" width="400" height="400">
January 25, 2020 at 12:53 am #1143314AmitAll done, everything looks good. But yet remains a problem. When I load the page on mobile, the image should appear first and the text below the image. But in actual, both are appearing side by side and text looks messy.
January 25, 2020 at 5:27 am #1143479DavidStaffCustomer SupportUse this CSS instead:
.hero-columns { display: flex; } .hero-columns > div { width: 50%; } @media (max-width: 768px) { .hero-columns > div { width: 100%; } .hero-columns { flex-direction: column; } }
January 25, 2020 at 5:51 am #1143501AmitStill the same! I have inserted this CSS in the main Style.css of the child theme…
January 25, 2020 at 5:57 am #1143507DavidStaffCustomer SupportCan you provide a link to the page where i can see the problem?
January 25, 2020 at 5:59 am #1143509AmitJanuary 25, 2020 at 6:04 am #1143513DavidStaffCustomer SupportMade a change to the CSS here
January 25, 2020 at 6:20 am #1143526AmitWhen I am resizing the browser, it is not acting responsive. Also when I checked in the Appeareance > Customize> Mobile View and Tab View, but there also not responsive!
January 25, 2020 at 6:31 am #1143547AmitI guess there was some copy-paste error, now works fine!
January 25, 2020 at 6:39 am #1143555DavidStaffCustomer SupportAwesome – glad to hear that ๐
-
AuthorPosts
- You must be logged in to reply to this topic.