0

I'm a beginner to HTML and I'm trying to position text on my HTML page i am unsure if CSS is needed to position text on a page.

Villainy
  • 125
  • 7

5 Answers5

2

CSS is absolutely how you position and style any HTML elements. You can use simple tags, like <b> or <i>, for minor formatting. Unless you're only building a motherfucking website, you'll want to use CSS. If you run into problems, post specific issues in this forum.

benjarwar
  • 1,794
  • 1
  • 13
  • 28
1

great that you are diving into html !

Because this seems like a "basic" question and you've pointed out you are a beginner I'm just going to recommend some resources to learn more:

https://www.codecademy.com/ is a great source for learning code and it's free. They have an html/css course right here

some others which offer basic html/css courses (not free): https://www.codeschool.com/ https://teamtreehouse.com/

Have fun learning!

Vincent
  • 348
  • 1
  • 9
1

you can do like this

<b style="margin: auto; width: 13px; color: yellow; background-color: red;>Some text</b>

this is a very basic part of html :) good luck learning html and have fun coding :)

Patric Nøis
  • 208
  • 2
  • 8
  • 27
  • As I say in another comment below, inline CSS should be used sparsely, if at all. Use separate .css files and `````` them to your HTML document. – benjarwar Oct 31 '15 at 21:35
  • [More](http://stackoverflow.com/questions/2612483/whats-so-bad-about-in-line-css) [thorough](https://teamtreehouse.com/community/when-is-inline-css-a-good-idea) [arguments](http://webdesign.about.com/od/css/a/aa073106.htm) [against](http://robertnyman.com/2008/11/20/why-inline-css-and-javascript-code-is-such-a-bad-thing/) [inline](http://programmers.stackexchange.com/questions/138538/is-it-a-bad-practice-to-use-inline-styling-with-generated-code) [CSS](http://www.sitekickr.com/blog/reasons-avoid-inline-css-javascript/). – benjarwar Oct 31 '15 at 21:38
0

You do need CSS, however you can use styles in your HTML tags, but this should be very limited. For example

<div style="background-color: black; color: grey; margin: auto;">Some text</div>

or if you don't want to have a separate CSS file, you can use CSS in HTML like this:

Something
<style>
div {
background-color: black;
color: grey;
margin: auto;
}

In both cases you are using CSS only they are in your HTML file.

I STRONGLY encourage you to start learning CSS, as that is something you will need.

super11
  • 436
  • 7
  • 19
  • I'd strongly advise against using inline CSS. For one thing, priority is given to styles declared inline, which makes it trickier to create classes and/or style your elements from a stylesheet. For another thing, it's better organizationally to keep your CSS in separate file(s) and attach it to your HTML document with a `````` tag; this will keep things organized as your project grows. – benjarwar Oct 31 '15 at 21:34
  • 1
    I strongly agree, I'm only giving the possibilities. – super11 Nov 01 '15 at 10:24
0

Wrap the content in <center> tags, so it looks like this: <center>..Content..</center>

ALEX
  • 64
  • 1
  • 6