Jump to content
cf666

Can't Center Styled Text Block On Page...

Recommended Posts

cf666

Please take a look at http://carinafeldman.com/ana/ and tell me what I'm doing wrong, I've run out of things to try here...

 

I'd like the block of text on the home page to be CENTERED on the page, both vertically and horizontally, no matter how the browser window gets resized.

Someone has suggested I try 

 

this is the HTML for that block of text:

 

<div class="frontpgblock">
<p class="dateblock"><span id="thursday">THURSDAY</span>
<span id="twentyeight">28</span>
<span id="march">MARCH</span>
<span id="twentythirteen">2013</span></p>
<p class="main-paragraph"><span id="anaalex">ANA &amp; ALEX</span>
<span id="aregetting">ARE GETTING</span>
<span id="married">MARRIED</span></p>
</div>
 
and this is the CSS I wrote for it. What's highlighted in red is what I tried last (at someone's suggestion) but it doesn't work either:
 
.frontpgblock {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -400px;
    margin-top: -100px !important;
}
 
 
.dateblock {
align:center;
font-family:Montserrat;
float:left;
display:inline;
border-right:0.3em solid black ;
padding-right:0.7em;
 
 
}
 
.main-paragraph {
align:center;
padding-left:0.7em;
font-family:Montserrat;
float:left;
display:inline;
 
}
 
#thursday {
font-size:2em;
line-height:1em;
 
}
 
#twentyeight {
font-size:10em;
line-height:0.85em;
}
 
#march {
font-size:3em;
line-height:1em;
}
 
#twentythirteen {
font-size:5.2em;
line-height:0.9em;
}
 
 
#anaalex {
font-size:6.75em;
color:red;
line-height:0.75em;
 
}
 
#aregetting {
font-size:6em;
line-height:1.1em;
}
 
#married {
font-size:8.5em;
line-height:0.7em;
}
 

What do I need to do??

Thank you...

Share this post


Link to post
Share on other sites
Danny

Hi,

 

I think the issue is your HTML is not structured correctly to do this type of layout. I recommend you view these two links for assistance and amend your HTML.

 

I wouldn't use the <p> tag, this then requires a negative margin and floats.

 

http://stackoverflow.com/questions/8187275/css-center-text-both-horizontal-and-vertical

http://css-tricks.com/vertically-center-multi-lined-text/


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
cf666

thanks so much, Danny!

I'll check it out and see if my pea-sized brain can wrap itself around this!

Share this post


Link to post
Share on other sites
James B

Let us know if this works for you :-)


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
cf666

will do, as soon as I have a free moment to sit down with it, thanks so much!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

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

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • Erika
      By Erika
      My sidebar is now showing up below the content, but only on the homepage. 
      I've tried disabling plug-ins individually, checking column width, and <div> tag errors on the page as well as in individual posts that are displayed on my homepage. I don't know exactly when this issue arose, so I don't know what else to try! 
      Here's the page link:
      https://confessionsofacosmetologist.com/
    • gstrahle
      By gstrahle+
      Hi,
      I am hoping to figure out how I can get my PageLines Full Nav to display layered in front of a sticky footer element on my website - 3keymedia.com
      I would like the Full Nav to overlay the entire screen when opening the menu as you will see when opening on a desktop the footer of nav content is cropped by the sticky footer.
       
      Thanks


    • Christian
      By Christian+
      Hi everyone, since Instagram had allowed to publish in different ratio formats (instead of only square ratio) the grams stripe has different heights. Can you tell me if i can fix it easily with some CSS?
    • Michael Kummer
      By Michael Kummer+
      Hi guys!
      I have noticed that my primary sidebar becomes intermittently invisible when browsing through various blog articles on michaelkummer.com/blog.
      See:
      https://www.dropbox.com/s/z646sgoa3mfjl1j/Screenshot 2018-07-12 15.57.46.jpg?dl=0 and https://www.dropbox.com/s/vdledzzgginvwgv/Screenshot 2018-07-12 15.57.57.jpg?dl=0
      Upon refresh, the sidebar appears. I have been using the following CSS code to hide the sidebar on mobile without any issues. 
      @media only screen and (max-width: 993px) {
      /* hide sidebars */
           .plsb {
              display: none !important;
          }
      }
      I tried to add the following CSS to force the sidebar to show on screens that are wider than 994 pixels but to no avail. Any clue what could be causing this issue?
    • Michael Kummer
      By Michael Kummer+
      Hi guys!
      I am using the LESS/CSS Pagelines extension and tried to add the following code to make use of FontAwesome:
      a.c2a:before {
          content: "\f07a\00a0";
          font-family: "Font Awesome 5 Pro";
          Font-weight: 900;
          font-style: normal;
          font-weight: normal;
          text-decoration: inherit;
          padding-left: 4px;
      }
       
      The issue is that as soon as I have the CSS via the Custom Styling text box, Pagelines (or the extension) strips out the backslashes (\). As a result, I had to abandon the CSS/LESS extension and instead add all my CSS code to a separate .css file.
      Is there a fix or workaround for this?
      Thanks
      Michael
×