Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Can anyone tell me why my text is not side right aligning?

<div class="sideright">

<h3>Features</h3>

<ul>
<li><a href="Featured Artist">Featured Artist</a></li>
<li><a href="Items">Items</a></li>
<li><a href="Brands">Brands</a></li>
<li><a href="Up And Coming Events">Up And Coming Events</a></li>
<li><a href="Heavy Rotation">Heavy Rotation</a></li>
</ul>

</div>

<div class="main">

<p>Lorem ipsum dolor sit amet, ex vel delectus voluptatibus. In nisl hinc perpetua vel, in viderer quaeque usu. Soleat lobortis definitionem in has, esse velit nec te. Vel veritus expetenda argumentum ne, eius latine ut mea, ad modo tale vix. Vivendo contentiones definitionem ei sed, eam semper referrentur te.

Aperiam quaestio eleifend ex mel, cu ullum malorum gubergren per, ius suavitate aliquando ea. Vocibus omnesque sententiae mei ad, dolorem appetere id cum. Eam in vitae causae propriae, vis ad accusam adipiscing. At primis melius quo, at qui urbanitas expetendis, eu nam nibh definiebas. </p>

Jamie Reardon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

Can you add your CSS code to the question as well?

Also, which part of your content are you talking about? The div class of sideright or your div class with the name main?

Side note: Not sure if you understand how the href attribute value works on your links. However, the value's you are entering here are incorrect, the href value must be a path to a filename or absolute url for example:

<a href="http://www.mywebsite.com">Link Text</a> <!-- Absolute url link -->
<a href="#top">Back to top</a> <!-- Internal page link, which targets an element with the id of top (you can link to different sections of your webpage). -->
<a href="featured-artist.html">Link Text</a> <!-- Link to a file named featured-artist.html within the same directory. -->

With the above example explained, in your links with whitespace inbetween text, the browser will add an "%20" as the character space as well.

Got you I was add the html to it. I actually don't have any css for, I was understanding that you could do it with just html...?

Jamie Reardon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

If you mean with just your HTML page to style the content (as in text-aligning to the right) then you can only achieve that by internally adding CSS to the HTML like so:

Internal CSS - Internal CSS is applied directly to your head element within your page, with the opening and closing style tag.

<head>
 <style>
  .main {
    text-align: right;
  }
 </style>
</head>

Inline CSS - Inline CSS is applied directly to the opening element tag with the style attribute.

<div class="main" style="text-align: right;">
</div>

The HTML language is just to structure your content, all your styling such as text-aligning content is achieved through CSS.

It is also best practice to create an external CSS file and link it to your HTML document as adding it internally to your HTML page can give a lot of disadvantages than benefits.

You can do that by adding a link element to your head element that specifies the path to the file (again another valid example of your href value):

<head>
  <link rel="stylesheet" href="path-to-file">
</head>
Steven Parker
Steven Parker
229,744 Points

This seems to be a duplicate of your previous question. Please don't post the same question multiple times!

1 Answer

Steven Parker
Steven Parker
229,744 Points

I notice your code has a class of "sideright", which I would expect is intended to apply the right-alignment. Normally this would be defined in an external CSS file, but since you said you don't have one, you can define it in the head section of the html:

<head>
  <!-- title and other head items -->
  <style>
    .sideright { text-align: right; }
  </style>
</head>