Center Your Text Vertically on Google Sites

Trying to spice up my Google Sites page, I decided to take matters into my own hands and customize the banner at the bottom of the site. My goal was to create an orange rectangle with two lines of text perfectly centered both horizontally and vertically. Despite successfully achieving most of what I wanted, I ran into trouble centering the text vertically. I attempted various solutions from StackOverflow, but none seemed to work for me. Has anyone else encountered this issue or can spot where I might have gone wrong?

I attempted to implement the code provided in this solution: How do I vertically center text with CSS? (Mine is based on the solution that references Sebastian Ekström)

<div style="margin-top: 60px; 
            margin-bottom: 60px; 
            background-color: #f16739; 
            height: 200px; 
            text-align: center">
  <p style="color: #ffffff; 
            font-size: 16px; 
            letter-spacing: 1px;
            line-height: 24px; 
            -webkit-transform-style: preserve-3d; 
            -moz-transform-style: preserve-3d; 
            transform-style: preserve-3d; 
            position: relative; 
            top: 50% transform: 
            translateY(-50%);">Plan: B Cleaning works with your schedule so you can enjoy more of what you love.<br><a href="https://sites.google.com/a/planbcleaning.com/planbcleaning2-0/home#contactus">Contact us</a> today to schedule your free consultation.
  </p>
</div>

Answer №1

Could this be "the solution"? Google openly admits to restricting styling options. Following advice from Colin Toh, I opted for a CSS Table, and it appears to work well on Google Sites.

Here is what I came up with:

<div style="margin-top: 50px; margin-bottom: 50px; background-color: #f16739; height: 100px; width:100%; display:table">
  <div style="display: table-cell; vertical-align: middle; text-align: center; background-color: transparent; font-size: 16px">
    <span style="color: #ffffff; letter-spacing: 1px; line-height: 24px">Plan: B Cleaning collaborates with your timetable so you can indulge in more of your passions.<br>
      <a href="https://sites.google.com/a/planbcleaning.com/public_2-1-1/home#contactus" style="color:#ffffff">Reach out</a> today to arrange your complimentary consultation.
    </span>
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Preventing text from wrapping in a TypeScript-generated form: Tips and tricks

I’m currently working on a ReactJS project and my objective is simple: I want all three <FormItem> components to be displayed in a single line without wrapping. However, I am facing the following output: https://i.stack.imgur.com/mxiIE.png Within ...

CSS: Stack elements vertically based on their height (column-wise)

Looking for some help with designing a menu where the list items float in columns instead of rows. For example, This is how my current menu looks like: I want to change the layout to look like this: My code for the list items is as follows: .mnu-third ...

Alter the loaded image based on the switch's current status

I am working with AngularJS material and I want to dynamically load an image based on the status of a switch. Here is the relevant HTML code: If the switch status sw_status.sw1 is true, then load the image truePic.jpg. If it is false, load the image false ...

Exploring the wonders of CSS with Socialchef

Hey, I recently came across a solution on Stack Overflow where they provided code for SocialChef to convert decimal inputs into fractions. I'm wondering how I can write or incorporate some code to input fractions and mantissa as a fraction... I ...

Ensuring proper input with JavaScript form validation

Currently, I am working on implementing a basic form validation feature, but it is not functioning as intended. The desired behavior is for the field border to change color to green or red based on its validity, while displaying text indicating whether t ...

I am encountering issues with the responsiveness of my layout as it is

My goal is to create a responsive layout utilizing code and examples from this website: www.responsivegridsystem.com To achieve this, I have nested a few containers to ensure a content area of 960px width centered within a 1000px container. My plan is th ...

How do I add a "Switch to Desktop Site" link on a mobile site that redirects to the desktop version without redirecting back to the mobile version once it loads?

After creating a custom mobile skin for a website, I faced an issue with looping back to the mobile version when trying to add a "view desktop version" link. The code snippet below detects the screen size and redirects accordingly: <script type="text/j ...

A Guide to Making a Floating Widget That Can Move Beyond the Boundaries of a Website in React

Currently, I am in the process of developing a project that requires the implementation of a floating widget capable of overlaying content not just within the confines of the website, but outside as well. This widget needs to have the ability to remain on ...

What is the best way to customize the color of the border and icon in an outlined MaterialUI input field

I'm a newcomer to materialUI and I have a question regarding customizing an outlined input field with an icon. Due to my dark background, I need the icon, border, and text color to be lighter, such as grey. Can someone please advise on the materialUI ...

Issue concerning invisible border

Let's take a look at my simplified CSS code: body { background: url('bg.gif') left top; } #content { background: #ddd; } .box { overflow: hidden; margin-top: 10px; background: #1e1e1e url('left-bottom-corner.gif&ap ...

Struggling to make the text color change when hovering

On my website, I added a tab called newarrival at the top of the page. When you hover over this tab, I want the text to turn blue to indicate that it's a link. However, despite my efforts, it doesn't seem to be working as expected. You can see th ...

Step-by-step guide on replacing a visible div with a new div when a button is clicked

I have organized my website with links on the left sidebar and matching content in the right sidebar, structured within appropriate div elements. My goal is to display only one div at a time when a user clicks on one of the links located on the left side. ...

Determining the visible dimensions of an iframe

Is there a way to determine the visual size inside an iframe using JavaScript or jQuery? In this scenario, only a portion of the iframe is displayed. The iframe itself has dimensions of 300x300, but it is being limited by a div to 300x100. <div style= ...

Conceal div elements and retain their status when the page is reloaded or switched

I currently have 3 div elements displayed on a webpage: header-div fixed_menu_div page_cont Each of these divs are styled with the following CSS properties: #header-div { top:0; left:0; display:inline; float:left; } #page_cont { mar ...

Adding a border to the input field in Bootstrap for enhanced styling and visibility

Looking to replicate the border style on an input element as shown in this image: The current code I have is producing a different result. Can anyone assist me in achieving the desired border style? <!DOCTYPE html> <html lang="en"> <head ...

How can I use a JavaScript or jQuery function to choose a specific audio track that is currently playing locally?

Currently, I have developed a music app that features local mp3 files triggered by clicking on divs which are linked to the audio using an onClick function with the play() method. Additionally, there is a scrolling screen that displays the song's arti ...

Error: AsyncPipe received an invalid argument of type '[object Object]'. This has caused an error due to an invalid pipe argument

I'm currently working on developing a contact management system that includes CRUD operations using Angular 8 and Spring Boot. Every feature is functioning correctly except for the search functionality. My goal is to search for data based on a specifi ...

Should ng-binding be avoided in CSS selectors as a general rule?

Recently, I stumbled upon this code snippet in our codebase: li.ng-binding span { font-size: 13px; font-family: Arial, Helvetica, sans-serif; font-weight: bold; } The selector above doesn't actually apply to one of the intended 'li& ...

Turning off CSS on a Wordpress page

I need some assistance with WordPress and CSS. By default, WordPress applies CSS to all posts and pages. However, I want to disable specific CSS styles for certain objects on the page. For example: When I insert a table, it automatically inherits the CSS ...

Tips for designing a unique mosaic using flex technology

I am attempting to design a unique mosaic layout using flexbox that resembles the image provided: https://i.sstatic.net/jrHvb.jpg Each box should have a width equivalent to one-third of the parent container, except for box 4 which needs to be double the ...