Do not want the text to be centered


Do not want the text to be centered



i've never programmed before or anything, but i have a college project in which i have to edit a layout.
there's a part of it in which the text is kinda in center, when it reaches the center of the page it skippes to next line.. i want it to continue normally..
https://jsfiddle.net/nqpa6jh0/#&togetherjs=vORwosTiHV




.image.feature2 {
display: block;
margin: 0 0 0em 0;
}

.image.feature2 img {
display: block;
width: 100%;
border-radius: 50%;
width: 200px;
height: 200px;
float: left
}

.image.feature3 img {
display: block;
width: 100%;
border-radius: 50%;
width: 200px;
height: 200px;
float: right;


<div class="wrapper style2">
<section class="container">
<header class="major">
<h2>Depoimentos</h2>
<span class="byline">Os viajantes recomendam.</span>
</header>
<div class="row no-collapse-1">
<section class="">
<a class="image feature2"><img src="images/pic02.jpg" alt=""></a>
<p>Nam in massa. Sed vel tellus. Curabitur sem urna, consequat vel, suscipit in, mattis placerat.</p>
</section>
</div>
</section>
</div>



here's how it's looking



enter image description here



that's how i wanted it to look like (photoshopped the first one):



enter image description here





Please create a jsfiddle, codepen or similar, for people to experiment with. Include a link to it in your question. Include everything needed for a working sample, even if it doesn't quite work, including the html, css, js and images, as needed.
– wazz
Jul 1 at 23:02






sorry didnt know. here it's the jsfiddle: jsfiddle.net/nqpa6jh0/#&togetherjs=vORwosTiHV
– beautyandthebeast
Jul 1 at 23:19





Are you using a framework or something?
– whitehathackersree
Jul 2 at 3:34





i'm not sure.. sublime text
– beautyandthebeast
Jul 2 at 13:08




1 Answer
1



Let me explain it properly to you.



From the photoshopped image, I can see what you are trying to achieve as well as the errors in your code. There are plenty of them.



Here: (redundant code)


.image.feature2 img {
display: block;
width: 100%;
border-radius: 50%;
width: 200px;
height: 200px;
float: left
}

.image.feature3 img {
display: block;
width: 100%;
border-radius: 50%;
width: 200px;
height: 200px;
float: right;
}



You are not using classes properly. Classes are meant to remove the redundant code in css. Lets consider you added a class myParentClass to the div containing the sections as well remove the class image feature2 on a element. Then the html would look like:


myParentClass


a


<div class="myParentClass row no-collapse-1">
<section class="">
<a ><img src="images/pic02.jpg" alt=""></a>
<p>Nam in massa. Sed vel tellus. Curabitur sem urna, consequat vel, suscipit in, mattis placerat.</p>
</section>
<section class="">
<a><img src="images/pic02.jpg" alt=""></a>
<p>Nam in massa. Sed vel tellus. Curabitur sem urna, consequat vel, suscipit in, mattis placerat.</p>
</section>
</div>



The above css can be replaced with:


.myClass section a img {
display: block;
width: 100%;
border-radius: 50%;
width: 200px;
height: 200px;
float: left
}

.myParentClass section:nth-child(odd) a img {
float: right;
}



And in order to make the text inside the p elements not to wrap around, you need to add white-space": nowrap. So:


p


white-space": nowrap


.myParentClass section p {
white-space: nowrap;
}



And to have the effect of having some whitespace to the left of odd section elements, you must use padding i.e,


odd


padding


.myParentClass section:nth-child(odd){
padding-left: 50px;
}





sorry, i dont get it the nth-child(odd).. i might be doing something wrong too because i added white-space": nowrap and it didnt do anything.. i must be doing something wrong i dont know
– beautyandthebeast
Jul 2 at 13:17





and this guy stackoverflow.com/a/51129526/10018813 seems to have fixed it.. but when i copy his code and paste here the text keeps same line. maybe thats something wrong with my computer..
– beautyandthebeast
Jul 2 at 13:18





No. There is nothing wrong with your computer. Maybe something is overwriting the rule. Just place it at the end of your css file, thus making it to override other rules if mistakenly defined.
– whitehathackersree
Jul 2 at 17:07





didnt work.. i think i'm gonna switch templates, the footer background went missing too.. thanks
– beautyandthebeast
Jul 2 at 19:20






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to add background colour in existing image using Swift?

Moria Casán

How to make file upload 'Required' in Contact Form 7?