Jump to content

Display icon and text on the same line using code block

Recommended Posts

I have this portion of the page that looks amazing on desktop, but once i view the mobile version, it's messed up. 

desktop version:
1825342965_Screenshot2020-07-03at4_34_00PM.thumb.png.d72a26ba28ca722fd2d23b69f6dd54d9.png
mobile version:
S__30253063.thumb.jpg.a71b62a31de4c4425a06a86e2595e4ac.jpg

i use code block for the icons (icons from Font Awesome) while and text for the text.

an example of my font code is : <i class="fas fa-street-view fa-4x"></i>

im trying to change and make my icon and text inline, so that for mobile version an icon + text will be on 1 line.
i am new to coding and thus i try:
<i class="fas fa-street-view fa-4x"></i><h3>18years old and above</h3>

but the icon and text are on different lines...

1768519820_Screenshot2020-07-03at4_42_39PM.png.fb205077239feb406c62c4a99054c6c6.png

how can i code it so that it will look like this on mobile too?
706406780_Screenshot2020-07-03at4_34_00PM.png.e4c0679cad18f3a38d45bece65f9b07f.png
align to left but the icon and text should align horizontally too..

Edited by JamieC
Link to comment
15 hours ago, tuanphan said:

Add to Home > Design > Custom CSS


@media screen and (max-width:640px) {
div#block-yui_3_17_2_1_1593682388012_80440+.row>.col>.row {
    display: flex;
    width: 100%;
}
}

 

Hi Tuanphan, thanks for the code, it works! My icons and text are now on the same line, however they are not aligned currently. This is how it looks like now on mobile version.
672199756_Screenshot2020-07-06at11_10_34AM.thumb.png.8dbeacad6156d9e4d884634f2cee61b2.png

Is there any way i can do to make the icons align centrally and the text all align to the left? So it will look something like this:
1049093548_Screenshot2020-07-06at11_10_34AM.thumb.jpg.6231c41af8ecc3d3ce2f86049ba8c5a3.jpg

Link to comment
  • 5 months later...

If it helps for anyone who finds this question later, I found a second fairly simple solution, though a bit more annoying if you're handing the site off to a client.

 I added my text into the code block that has the Font Awesome Icon and html styled it within there with spaces and line breaks, and was able to get it even with that.

 

 

Link to comment
  • 7 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.