• Resolved webdevtestus

    (@webdevtestus)


    Hi, and thanks in advance.NOTE: NSFW site, maybe some hot images from eBooks covers, no nude but adult romance covers.
    I have wordpress+woocommerce+storefront+bookshop child theme.
    I have this page , Just in case NSFW site,

    I created a shortcode with a PHP snippet that calls the excerpt, so far, so good.
    BUT I need to style the page, getting the image to the left and the text, star rating, price, title to the right.
    I found some workaroung playing with the CSS classes I found inspecting the page, BUT I need to get the style better:

    /*Float image to the left*/
    ul.products li.product img {
    	float: left;
    }
    
    /*Add hover to image*/
    a:hover img { border:solid #eeccdd 5px; 
    }
    
    /*Change Title color and float text to right*/
    ul.products li.product .woocommerce-loop-product__title, ul.products li.product h2, ul.products li.product h3{
    	color: #cc5588;
    	float:right;
    	margin-bottom: 3em;
    }

    I need to enhance this result like this:
    – Get the title Up and centered plus aligned to the container (within, not above or below, now it seems to be lower than the image container) I think I can do that (put the title at the top) changing hook priorities, but I guess it should be some CSS trick to do that.
    – Get some space between image and text (now they are together)

    Thanks in advance!

    • This topic was modified 5 years, 8 months ago by webdevtestus.
    • This topic was modified 5 years, 8 months ago by webdevtestus.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter webdevtestus

    (@webdevtestus)

    Ok, I had some advances, I could center excerpt but still have star rating left-handed.
    I also could lift the title (it had some clear that I set to none and done)
    here the code so far, I`ll keep trying to center now title at the top and try to center the star rating too…and to get some space between image and excerpt </strong>

    /*Float image to the left*/
    ul.products li.product img {
    	float: left;
    }
    
    /*Add hover to image*/
    a:hover img { border:solid #eeccdd 5px; 
    }
    
    /*Change Title color and float text to right*/
    ul.products li.product .woocommerce-loop-product__title, ul.products li.product h2, ul.products li.product h3{
    	color: #cc5588;
    	float:right;
    	width: auto;
    }
    
    /*Center Excerpt and price and Button Get it now*/
    ul.products li.product{ 
    text-align: center;
    }
    
    /*Lift Up title*/
    .beta, h2 {
    	clear: none
    }

    • This reply was modified 5 years, 8 months ago by webdevtestus.
    Job a11n

    (@jobthomas)

    Automattic Happiness Engineer

    Hey @webdevtestus – you can add your stars to the right but adding the following:

    ul.products li.product .star-rating {
      float: right;
    }

    It seems to me that working with either CSS grid or flexbox would allow you to change around a lot of the elements you’re looking to move.

    Here are gamified tutorials for each of them:

    * https://cssgridgarden.com/
    * https://flexboxfroggy.com/

    Thread Starter webdevtestus

    (@webdevtestus)

    Hi, @jobthomas and thanks
    For some reason it does not work at all
    In fat, I can only move stars with marginf-left : 45%; or any value, BUT it moves within whole site, I only need to style THIS star rating, don`t know how

    By the way, I knew flexbox froggy, but didn`t know Grid garden, awesome tool! thanks
    thanks!

    Job a11n

    (@jobthomas)

    Automattic Happiness Engineer

    Hey @webdevtestus – as soon as I disable your auto right margin, the star ratings align to the right:

    align stars to right
    Link to image: https://cld.wthms.co/pExM2F

    Thread Starter webdevtestus

    (@webdevtestus)

    Hey @jobthomas, thanks a lo, that gave me the tip to solve most of things so far
    I still have to put Price at the bottom, just before the Badge, but I can t (I used order and some PHP magic buit it didnt work)

    ?	Changed float: left to title to display:inline-block
    /*Change Title color and float text to left*/
    ul.products li.product .woocommerce-loop-product__title, ul.products li.product h2, ul.productsli.product h3{
    olor: #cc5588;
    display: inline-block;
    	width: auto;
    }
    ?	SOLVED added padding: 10px to image - make some space between image and text
    /*Float image to the left*/
    ul.products li.product img {
    	float: left;
    	padding: 10px;
    }

    Hi @webdevtestus,

    So at this point, you need to move the price below the excerpt, down next to the add to cart button. Is that right?

    That should be possible by rearranging the order of the items in your custom shortcode. Could I get you to go to https://gist.github.com/ and add the code for your shortcode there? Then copy the URL to the gist they give you and paste it here in your reply. That way I can see the code you’re working with.

    Thanks,

    Thread Starter webdevtestus

    (@webdevtestus)

    Thanks a lot @3sonsdevelopment

    here the link

    https://gist.github.com/webdevtestus/1b7afc4044c0037d9666dd83ba3f1813

    for some reason the php code don’t work at all, neither the CSS

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘align image to the left and text to the right in storefront custom page NO edit’ is closed to new replies.