Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I have a difficulty put a text "My First Blog" in center. Please open the https://drive.google.com/file/d/1gsgaaHBm2pNC3HMNxfdn9WxGT8ninVgK/view?usp=sharinglink to see what exactly I meant.

What I have tried:

I have tried the following CSS, but the text breaks up itself still. It doesn't look good on the website, so I appreciate any tips.

@media only screen and (max-width: 700px)
.imageSectionWrapper {
    color: white;
    background-color: #1c2329;
    width: 400px;
    padding: 0.25em;
    opacity: 0.97;
    border-radius: 2px;
    margin: 0 auto;
}


HTML
<pre><body data-new-gr-c-s-check-loaded="14.1001.0" data-gr-ext-installed="">
	<div class="nav">
        <div class="navWrapper">
            <a href="#"><img src="./images/Blogit_Logo.png" alt="blog it image"></a>
            <a href="#"><div class="menu"><img src="./images/Menu_icon.png" alt="menu icon">
            <p>Categories</p></div></a>
            <div class="right">
                <a href="#"><div class="search"><p>Search</p><img src=".images/Search_icon.png" alt="search icon"></div></a>
                <a href="#" class="navIcon"><img src="./images/Bell_icon.png" alt="bell icon"></a>    
                <a href="#"><img src="./images/Profile_icon.png" alt="profile_icon"></a>
            </div>
        </div>
    </div>
    <div class="imageSection">
        <div class="imageSectionWrapper">
            <div class="blogPostInfo">
                <h1>My First Blog!</h1>
                <div class="info">
                    <p>By Florian Zejewski2 days ago</p>
                    <p>My journey as an investor.</p>
                </div>
            </div>
        </div>
    </div>
Posted
Updated 29-Mar-21 10:32am

1 solution

First thing, try jsbin -- here's your html and css in a jsbin:

JS Bin - Collaborative JavaScript Debugging[^]

Here's the code:
HTML
HTML
<h1 id="centerMe">My First Blog!</h1>


CSS
CSS
#centerMe{
  text-align:center;
}


and if you wanted all your H1 tags to be centered you could do:

CSS
h1{text-align:center}


Check it out at the JSBIN -- change it to whatever you want and you'll see it live.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900