Paragraphs in two-column layout have different top heights - html

I have this two inline block text side by side but one them has one more paragraph and it mess up the text.
As you can see the "who we are" paragraph has weird height and i want to be potion same as "what we do" paragraph so it looks like this
This is my code
#wrapper {
width: 100%;
border: 1px solid blue;
text-align: left;
}
#content {
width: 25%;
margin-left: 15%;
font-size: 16px;
display: inline-block;
}
<div id="wrapper">
<div id="content">
<h1>What We Do</h1>
<span>
<p>I'm a paragraph. Click here to add your own text and edit me. It’s easy. Just click “Edit Text” or double click me to add your own content and make changes to the font. Feel free to drag and drop me anywhere you like on your page. I’m a great place for you to tell a story and let your users know a little more about you.</p>
<p>This is a great space to write long text about your company and your services. You can use this space to go into a little more detail about your company. Talk about your team and what services you provide. Tell your visitors the story of how you came up with the idea for your business and what makes you different from your competitors. Make your company stand out and show your visitors who you are.
</p>
</span>
</div>
<div id="content">
<h1>Who We Are</h1>
<span>
<p>I'm a paragraph. Click here to add your own text and edit me. It’s easy. Just click “Edit Text” or double click me to add your own content and make changes to the font. Feel free to drag and drop me anywhere you like on your page. I’m a great place for you to tell a story and let your users know a little more about you.</p>
<p>This is a great space to write long text about your company and your services.</p>
<p>This is a great space to write long text about your company and your services. You can use this space to go into a little more detail about your company. Talk about your team and what services you provide. Tell your visitors the story of how you came up with the idea for your business and what makes you different from your competitors. Make your company stand out and show your visitors who you are.
</p>
</span>
</div>
</div>
what do i need to do. i think there is already an topic for this but i don't know whats its called because English is not my first language.

Add the vertical align property to your #content element in your CSS code:
#content{
width:25%;
margin-left:15%;
font-size:16px;
display: inline-block;
vertical-align: top;
}

#wrapper {
width: 100%;
border: 1px solid blue;
text-align: left;
}
#content {
width: 25%;
margin-left: 15%;
font-size: 16px;
display: inline-block;
vertical-align: top; /* <-------------------- your huckleberry */
}
<div id="wrapper">
<div id="content">
<h1>What We Do</h1>
<span>
<p>I'm a paragraph. Click here to add your own text and edit me. It’s easy. Just click “Edit Text” or double click me to add your own content and make changes to the font. Feel free to drag and drop me anywhere you like on your page. I’m a great place for you to tell a story and let your users know a little more about you.</p>
<p>This is a great space to write long text about your company and your services. You can use this space to go into a little more detail about your company. Talk about your team and what services you provide. Tell your visitors the story of how you came up with the idea for your business and what makes you different from your competitors. Make your company stand out and show your visitors who you are.
</p>
</span>
</div>
<div id="content">
<h1>Who We Are</h1>
<span>
<p>I'm a paragraph. Click here to add your own text and edit me. It’s easy. Just click “Edit Text” or double click me to add your own content and make changes to the font. Feel free to drag and drop me anywhere you like on your page. I’m a great place for you to tell a story and let your users know a little more about you.</p>
<p>This is a great space to write long text about your company and your services.</p>
<p>This is a great space to write long text about your company and your services. You can use this space to go into a little more detail about your company. Talk about your team and what services you provide. Tell your visitors the story of how you came up with the idea for your business and what makes you different from your competitors. Make your company stand out and show your visitors who you are.
</p>
</span>
</div>
</div>

There are two solutions:
Solution One (Add vertical-align: top; in content class):
#content{
width:25%;
margin-left:15%;
font-size:16px;
display: inline-block;
vertical-align: top;
}
Second Solution:
Add inline css in first content div
<div id="content" style="float:left;">

A simple solution for this would be the following:
#content {
width: 25%;
margin-left: 15%;
font-size: 16px;
float:left;
}
You do not need to define width:100% for #wrapper, div is a block level element. You also don't need text-align:left; since text-align:left is the default rule for all element unless an upper level has a different align rule. display:inline-blocks is treated as a table cell, which by default has its value as "baseline", you can read from here http://www.w3schools.com/cssref/pr_pos_vertical-align.asp
Also, you should not be putting <p> inside of <span>, <span> is an inline block element and <p> is a block level element; Here is what I would do, it's simple and works and it is not based on hacks.
You may be more interested in the quick fix but its important to know the rules because hacks eventually collapse.
Hope this helps.
#wrapper {
border: 1px solid blue;
}
#wrapper:after {
content: '';
display:block;
clear:both;
}
#content {
width: 25%;
margin-left: 15%;
font-size: 16px;
float:left;
}
<div id="wrapper">
<div id="content">
<h1>What We Do</h1>
<div>
<p>I'm a paragraph. Click here to add your own text and edit me. It’s easy. Just click “Edit Text” or double click me to add your own content and make changes to the font. Feel free to drag and drop me anywhere you like on your page. I’m a great place for you to tell a story and let your users know a little more about you.</p>
<p>This is a great space to write long text about your company and your services. You can use this space to go into a little more detail about your company. Talk about your team and what services you provide. Tell your visitors the story of how you came up with the idea for your business and what makes you different from your competitors. Make your company stand out and show your visitors who you are.
</p>
</div>
</div>
<div id="content">
<h1>Who We Are</h1>
<div>
<p>I'm a paragraph. Click here to add your own text and edit me. It’s easy. Just click “Edit Text” or double click me to add your own content and make changes to the font. Feel free to drag and drop me anywhere you like on your page. I’m a great place for you to tell a story and let your users know a little more about you.</p>
<p>This is a great space to write long text about your company and your services.</p>
<p>This is a great space to write long text about your company and your services. You can use this space to go into a little more detail about your company. Talk about your team and what services you provide. Tell your visitors the story of how you came up with the idea for your business and what makes you different from your competitors. Make your company stand out and show your visitors who you are.
</p>
</div>
</div>
</div>

Related

If it's in a main div with margin, make a div with a width of 100vw

I'm trying to make a div with a width of 100vw to cover all viewing areas, however, it comes in a div with a margin, so I'm having trouble.
I've also included an image link below to help you understand.
* {
margin: 0%;
padding: 0%;
}
body {
background: black;
margin: 2rem 6rem;
color: white;
}
/* About Section */
.about {
display: block;
background-color: #2e3038;
margin-left: -6rem;
margin-right: 6rem;
}
<body>
<div class="about">
<div id="col1">
<h3>A co-founder at one of the world's largest communities.
</h3>
<p>
The combined experience I have working at the top Fortune 500 companies has allowed me to develop a skill set that helps me in not just development but in every aspect of any business. <br> I'm proud to announce that I am now working at one
of the world's largest communities teaching young minds about how to sell themselves as a developer and open them to a whole new world of opportunities.
</p>
</div>
<div id="col2">
<p>As a developer, you have everything available to you and all that's holding you back is yourself. <br> A quote I live by perfectly illustrates what I mean. <br> "How big would you dream, if you knew you wouldn't fail?" You've already gone through
the hardest parts of being a developer, it's time to elevate your skills and become a leader in something you're passionate about. <br> I'm happy to chat over coffee some time about how I can help your company.</p>
</div>
</div>
</body>
As you can see, I attempted to use margin-right, however, it would not work.
I can't use inspect element since the design I'm attempting to replicate is in png format.
You're close - you've just specified the wrong direction for margin-right:
* {
margin: 0%;
padding: 0%;
}
body {
background: black;
margin: 2rem 6rem;
color: white;
}
.about {
background-color: #2e3038;
margin-left: -6rem;
margin-right: -6rem;
}
<body>
<div class="about">
<div id="col1">
<h3>A co-founder at one of the world's largest communities.
</h3>
<p>
The combined experience I have working at the top Fortune 500 companies has allowed me to develop a skill set that helps me in not just development but in every aspect of any business. <br> I'm proud to announce that I am now working at one
of the world's largest communities teaching young minds about how to sell themselves as a developer and open them to a whole new world of opportunities.
</p>
</div>
<div id="col2">
<p>As a developer, you have everything available to you and all that's holding you back is yourself. <br> A quote I live by perfectly illustrates what I mean. <br> "How big would you dream, if you knew you wouldn't fail?" You've already gone through
the hardest parts of being a developer, it's time to elevate your skills and become a leader in something you're passionate about. <br> I'm happy to chat over coffee some time about how I can help your company.</p>
</div>
</div>
</body>
Full Width Containers in Limited Width Parents | CSS-Tricks

how How do I align right the text inside <p> while maintaining the correct paragraph mode?

Texts are displayed word-for-word in both and sections after specifying margins.I want the contents of the first and tags to be on the left and the contents of the second and tags to be on the right.I want to solve this operation according to properties such as margin left, margin right and inline styling.I am currently training at this level and I have to practice with this tool
<!doctype html>
<html lang="en";>
<head>
<title>solarise_mk</title>
</head>
<body style="background-color:rgb(233, 150, 122);">
<br>
<br>
<br>
<!--Several nested tags to create a key to link to another site-->
<!--start coding for the key -->
<a href="https://www.herzing.edu/description/computer-programmer ">
<h1 style="text-align:center;">
<mark style="background-color:rgb(64,224,208);
color:rgb(233, 150, 122);
padding:30px;
border-radius:35px;
font-family:Times New Roman";>
solarise-mk
</mark>
</h1>
</a>
<!--end coding for yhe key-->
<br>
<br>
<br>
<br>
<br>
<!--The following code is for inserting a photo from another site-->
<center>
<img src="https://www.herzing.edu/sites/default/files/styles/fp_960_640/public/2020-09/it_computer_programming.jpg.webp?itok=8aEwtSxk" alt="What Does a Computer Programmer Do?" style="width:1000px;height:700px;">
</center>
<!--ending coding for photo-->
<br>
<br>
<br>
<br>
<br>
<!--start first Start the first header and paragraph-->
<h3 style="color:rgb(139,0,139);font-family:Times New Roman;margin-left: 10%;margin-right: 90%;">Site goals:</h3>
<p style="color:rgb(255,240,245);font-family:Times New Roman;;margin-left: 10%;margin-right: 90%;">
we want to introduce you
exciting art of computer programming
And what programming is,what capabilities
are needed...
If you find you are interested in this
technique And you have traces of the ability
to accurately observe and then analyze
them correctly,Join us to enter the field of
programming professionally
</p>
<!--end first the firstparagraph-->
<br>
<br>
<br>
<br>
<br>
<!--Start the second header and paragraph-->
<h3 style="color:rgb(119,136,153);font-family:Times New Roman;margin-left: 90%;margin-right: 10%;">As the site owner:</h3>
<p style="color:rgb(230,230,250);font-family:Times New Roman;;margin-left: 90%;margin-right: 10%;">
Ever since I got to know myself, I have noticed
I prefer to have a private and safe environment
to think about analyzing problems and to
discovering creative solutions to solve them.
Usually I look around in detail, Unless I'm
focused on fatigue.I am interested in mathematics,
painting and artwork.Of course, mathematics,
except for arithmetic and mental counting,because
sometimes it is difficult for me to concentrate
and I basically know this as long as there
is a calculator.
People around me tell me that you are smart but
distracted and I believe in this judgment.
Distraction has become a problem for me in
many places,if I did not have the other
capabilities next to it might have been a
problem .
Finally, I love programming and one of
my goals is to specialize in this field e.
</p>
<!--end the second header and paragraph-->
</body>
</html>
Doing all that inside one single paragraph tag is unnecessary and not often done. You should instead divide the content up into 3 sections. One for the left content, one for the center content and the last one for the right content. Do this with <div> tags (or other elements such as <aside> and <main>):
<div class="left_div">Left content</div>
<div class="center_div">Center content</div>
<div class="right_div">Right content</div>
/* css */
.left_div { width: 20%; text-align: left; }
.center_div { width: 60%; text-align: center; }
.right_div { width: 20%; text-align: right; }
This produces 3 sections or divisions, where text-align takes care of aligning the contents of the divs.
You can also use float: left; (or right;) on image elements or button elements to make those elements shift to one side while making the text around it flow around the object that is floated. This is often done with images inside of text.

Text not wrapping, instead opts to go under

My Problem
So I am trying to create a news section for my website. Each section contains a title, an image, and the article itself. The problem is that the article text will refuse to go beside the image unless I use <br> to break it up myself.
Description
All the elements of each section is listed under a single div element. The section includes the title, image, and article. After that, the picture has its own class and the article also to CSS after.
The Title is a block element
The Picture is an inline-block element
The Article is an inline-block element
HTML CODE (STARTING FROM NEWS BOX NOT INCLUDING NAV BAR AND ABOVE)
<div id=newsboard>
<div class=newsboard_topic>
<h1>Website in Development!</h1>
<img src="/image/newsboard/construction.gif" alt="Dev">
<p class=newsboard_topic_article>
Greetings!
<br>The GeoVillage website is currently under construction, but feel free to register and login to check out the stuff we have so far!
<br>- Geo Jones
<br>Owner and Developer
</p>
</div>
<div class=newsboard_topic>
<h1>kimmy and donald!</h1>
<img class=newsboard_topic_picture src="/image/newsboard/kimdon.jpg" alt="kimmyanddonald">
<p class=newsboard_topic_article>
The fan fiction of Donald Trump and Kim Jong Un! Yes, they photoshopepd it. This is a test by the way to test the standing of articles.
</p>
</div>
</div>
CSS CODE FOR SECTION OF HTML
#newsboard {
margin-left: 100px;
margin-right: 100px;
margin-top: 25px;
margin-bottom: 25px;
border-color: #0099FF;
border-style: solid;
border-width: 5px;
}
.newsboard_topic {
padding: 20px;
display: block;
}
.newsboard_topic_article {
display: inline-block;
vertical-align: top;
word-wrap: break-word;
margin: 0px;
padding: 10px;
}
.newsboard_topic_picture {
display: inline-block;
}
LIVE EXAMPLE
is currently up at geo-village.com
Make the picture a floating element inside the text container, then the text will float next to it (and below it, if it's longer)
Separate your newsboard_topic class.
<div class=newsboard_topic>
<img src="/image/newsboard/construction.gif" alt="Dev">
<h1>Website in Development!</h1>
</div>
<p class=newsboard_topic_article>
Greetings!
<br>The GeoVillage website is currently under construction, but feel free to register and login to check out the stuff we have so far!
<br>- Geo Jones
<br>Owner and Developer
</p>
Then give your newsboard_topic class a display:flex;.
.newsboard_topic {
padding: 20px;
display: flex;
}
I think the obvious answer no one wanted to give, which would make a lot of your coding more smooth is... Bootstraps. If you are learning to code, I highly recommend learning from some of the great opensource solutions available.
<div class="row">
<div class="col-md-5">
<h1>Website in Development!</h1>
<img src="/image/newsboard/construction.gif" alt="Dev">
</div>
<div class="col-md-5">
<p class=newsboard_topic_article>
Greetings!
<br>The GeoVillage website is currently under construction, but feel free to register and login to check out the stuff we have so far!
<br>- Geo Jones
<br>Owner and Developer
</p>
</div>
</div>

Multiple white space in html

I would like to ensure that my chords above words are separated nicely by multiple white space.
The issue is that when I use pre, it comes out pre-formatted and hence not what I wanted.
Also, with , the code looks very ugly.
What is the best method to solve this?
<pre>Chorus:
Em A
A common love for each other
F#m Bm
A common gift to the Saviour
</pre>
Em A D D7
A common bond holding us to the Lord
Here is the link to the url: http://teach.sg/blog/a-common-love/
There are some white space characters like   will be useful. You can use for tab. You can also use CSS for this.
I have an alternative solution, please see if it is suitable for your purposes:
I have nested all chords in a <span class = 'chord'> element, and then used CSS style rules to move the chords up and to the left a little bit. There is a little bit of ugly whitespace with this method, but it is more concise and definitely much more elegant than spamming space characters.
.chord {
position: relative;
font-size: 0.8em;
bottom: 1.5em;
right: 2em;
width: 0.5em;
}
p {
line-height: 2em;
}
<body>
<p>A common love <span class='chord'>Em</span> for each other <span class='chord'>A</span>
</p>
<p>A common gift <span class='chord'>F#m</span> to the Saviour <span class='chord'>Bm</span>
</p>
<p>A common bond <span class='chord'>Em</span> holding us <span class='chord'>A</span> to the Lord <span class='chord'>D-D7</span>
</p>
</body>
JSFiddle here.

HTML element aside from headers <h1><h2>, ect

I was browsing related issues for my question but I can't seem to find the answer for it. Anyways, I want to know if I can still use the p or div tags instead of header tags when I have already used both (p and div tags) as plain text on my site. The reason is that I only want to have one header tag h1 present in my site. I tried to tweak some parts and got lost along the way. Sadly, after a couple of testing, it did not work... I was wondering if it's possible or if there's any other HTML tag that I can use other than header tag. Any response from you guys will be very much appreciated. =)
You can make a <p> look however you like, for example:
<p class="header">This is a header</p>
with
p.header { font-size: 200%; font-weight: bold; }
but I would recommend against it. The reason is that HTML is (ostensibly) semantic so if you declare:
<h3>This is a header</h3>
you're actually saying (semantically) that the given text is a heading of some sort. Remember you have <h1> through <h6> and you can pick and choose which of them you use. There is no need to use <h1> to use <h2> and so on.
This is also useful for those visually impaired as something styled as a heading won't be indicated as such to those using screen readers but a heading will be. You should cater for accessibility issues where possible.
You should not style a div, span, or p to look like a heading and then use it in place off an h1-h6. That is exactly contrary to the spirit behind the rule of thumb that you shouldn't have more than one h1 on a page.
<span> is a useful addition, as well.
You can use P and DIV tags over and over. If you need to, style them to look like H1's.
p.title {
font-size:18px;
font-weight:bold;
}
p.header2 {
background: url("bg.jpg");
}
--
<p class="title">My Title</p>
<p>And this paragraph will simply be regular text.</p>
<p class="title header2">My Other Title, with a Background Image</p>
<p>And this paragraph will also be regular text.</p>
Don't forget to remember SEO on your site. Presumably this is why you only want one H1 tag?
<span> <strong> and <em> are others you can use inside your <p> tags.
i would use <div> or <span> tags and use ids or classes to control the style. use ids if there is only once instance or classes if you want to repeat this style. you can also use multiple classes on one element
for example
<div id="text">Text Here</div>
<span class="red">This would be red</span>
<div class="red big">This would be big and red</div>
with css
#text{ font-size: 20px; }
.red{ color: red; }
.big{ font-size: 40px; }
hope this helps
You can use multiple h1's or h2's and just target them like this:
<div id="header"><h1>Title of page/h1></div>
<div id="main"><h1>Title of article</h1></div>
#header h1{ color:red;}
#main h1{ color:blue;}
It's not quite what you're asking. I suspect Google is a bit smarter than single H1 approaches.