Trying to control width and right-align, only one works

My knowledge of CSS is almost non-existent, but I'm trying to spruce up a Wordpress site and can't seem to get my text to be both a certain width and right aligned. Either one works on its own, but when I use

p{text-align: right;}
p {height:100px; width:300px;}

the width is correct but the alignment goes back to default (left). I'm sure this is not even how to make this effect work, but again this is pretty foreign to me and I appreciate any help.

The Wordpress theme has a box for custom CSS, and just for the sake of completeness this is everything I'm using:

body {color:#757575;} {color:#ff0000;}
p{font-family: Verdana, Geneva, sans-serif;}
p{text-align: right;}
p {height:100px; width:300px;} {
font-family: Century Gothic, sans-serif;}
h2{font-family: Century Gothic, sans-serif;}
nav {font-family: Century Gothic, sans-serif;}
a:link {color:#000000;}
a:visited {color:#000000;}
a:hover {color:#000000;}
a:active {color:#000000;}


Maybe the Wordpress css has a css rule that overrides yours. Keep in mind that if the theme css have eg. this css rule:

.paragraph p{
  text-align: left;

and below that you add this rule:

  text-align: right;

Even if you put your rule as the last one, it has lesser priority than the theme one so the css rule applied will be the theme one. Try to add the modifier important! so you'll have:

  text-align: right !important;

First, I'd recommend organizing your CSS so that all the P tags and all the H2 tags are in one set like changing this:

p {font-family: Verdana, Geneva, sans-serif;}
p {text-align: right;}
p {height:100px; width:300px;}


p { font-family: Verdana, Geneva, sans-serif; text-align: right; height:100px; width:300px; }

Next, there could be a theme issue. If you do want all of your paragraphs to align right on the entire site, adding the "!important" as Erwin suggested most likely will fix that.

Tags: Css / Wordpress / Alignment

Similar questions

What does this line of CSS mean? @media only screen and (min-device-width: 320px) and (max-device-width: 480px)
I found the following line of code inside Wordpress' Twenty Eleven theme stylesheet. What does it mean?
How to create 3 media queries. One for mobile,one for tablet and one for full width
I have a site I'm working on ( below ) and the problem is this: The top menu does not lay out correctly when viewed in tablet devices. It kind of folds under itself. I figure an easy way to correct this would to simply create a media query for the respective dimensions that the problem occurs, and then to modify the css of the 'tablet.css' media qu...
How to align Facebook, Twitter, Google+ and LinkedIn buttons on the right?
I have internet portal, based on WordPress. There is one Facebook Like button (align - right), but when I am trying to integrate on the right other buttons (Twitter, LinkedIn and Google+), they are going to left side. I don't know how to align on the right them all. Don't have much knowledge about CSS, so that's why i'am asking help. This is how is...
WordPress menu item float right and vertical align issue
I am hoping one of you CSS gurus can help me pinpoint why my code isn't working! Here's my site: When the browser window is > 600 pixels, the "CALL US" menu item is floating right and vertically centered in the menu bar. (on FireFox and Chrome) But, when the browser < 600 pixels, the menu item no longer floats right. And,...
How can I align two different-size pieces of text to the left and right while matching baselines?
I am trying to change how the title and tagline are displayed in the Coraline WordPress theme. I want them next to each other, aligned on their baseline, justified left and right. I'm new to CSS. I managed to figure out a solution, but it doesn't seem to work in Safari 8. What is a robust alternative that works in recent versions of all major brows...
How to align subnavigation and make it go right
My subnavigation for seems to not line up with the parent. Also, when it pops out it goes out to the left instead of to the right. How can I fix this so that the subnav lines up with parent and to make it go right instead of left? I am currently using OptimizePress theme via Wordpress. I included the HTML, if you need anythi...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.