Solved

Center Text in Div

Posted on 2015-01-21
2
108 Views
Last Modified: 2015-01-22
I am sure there is a simple solution that I am missing, but I've stared at this too long and I can get it to work. You can view the active page at http://starofthesouth.org/. I am just trying to center the three links (redeem CE, attendee and exhibitor) on the page.

Code follows. Thanks in advance.

.home-page{
	float:left;
	width:100%;
	height:100%;
	background:url(images/background.jpg) top center no-repeat;
	background-size:100% 100%;
}

.home-contents-container{
	float:left;
	margin-left:2%;
	width:96%;
	height:100%;
	position:relative;
}

.contents-container{
	float:left;
	margin-left:2%;
	width:96%;
	position:relative;
}

.home-logo{
	float:left;
	width:100%;
	text-align:center;
	margin: 50px 0 5% 0;
}

.home-logo img{
	width:100%;
}

.home-center-body{
	width:100%;
    	margin: 0 auto!important;
	text-align:center!important;
}

.home-links {
	width: 100%;
	margin: 0 auto!important;
	text-align: center!important;
}

.home-center-body a{
	font-size:40px;
	color:#FFF;
	padding: 10px;
	border:1px solid #fff;
	border-radius: 10px;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
	text-transform:uppercase;
	letter-spacing:4px;
	float: left;
	margin: 0 0 0 15px;
}

Open in new window


<div class="main-container">
	<div class="home-page">
    	<div class="home-contents-container">
            <div class="home-logo">
            	<a href="<?php echo site_url(); ?>">
                	<img src="<?php echo get_template_directory_uri(); ?>/images/logo.png"/> 
                </a>
            </div>
            
            <div class="home-center-body">

		<div class="home-links">

            	<?php
                $SQL = mysql_query("Select * from wp_posts where post_type = 'page' and post_parent = 0 and post_status = 'publish' order by menu_order ") or die(mysql_error());
				for ($i = 0; $i < mysql_num_rows($SQL); $i++){
				?>
                <a href="<?php echo get_permalink( mysql_result($SQL,$i,'ID') ); ?>">
                	<?php echo mysql_result($SQL,$i,'post_title');?>
                </a>
                <br/>
                <?php } ?>

		</div>

            </div>

Open in new window

0
Comment
Question by:43homes
2 Comments
 
LVL 3

Accepted Solution

by:
Marc Alonso earned 500 total points
ID: 40563677
Remove the break tags <br/> from the HTML file:


            <div class="home-links">

                  <?php
                $SQL = mysql_query("Select * from wp_posts where post_type = 'page' and post_parent = 0 and post_status = 'publish' order by menu_order ") or die(mysql_error());
                        for ($i = 0; $i < mysql_num_rows($SQL); $i++){
                        ?>
                <a href="<?php echo get_permalink( mysql_result($SQL,$i,'ID') ); ?>">
                      <?php echo mysql_result($SQL,$i,'post_title');?>
                </a>
             <br/>    ***remove this line***
                <?php } ?>

            </div>

            </div>



Then in your CSS file, remove the "float: left" tag:


.home-center-body a{
      font-size:40px;
      color:#FFF;
      padding: 10px;
      border:1px solid #fff;
      border-radius: 10px;
      -moz-border-radius: 10px;
      -webkit-border-radius: 10px;
      text-transform:uppercase;
      letter-spacing:4px;
      float: left;  ***remove this line***
      margin: 0 0 0 15px;
}
0
 

Author Closing Comment

by:43homes
ID: 40564088
Ugh! I knew it was something simple like that. Thank you!!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
html form to write data to csv 24 97
Download a website to hdd 2 52
To remove highlight from a "a href" 5 23
Alignment is not working correctly. 8 33
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now