-1

I'd like to know how can I change the position of block

Here's a code:

<div style="background-color:#COLOR;width: px;height: px;">
<p>This is a paragraph</p>
</div>

Is it

position:absolute;
right: px;

? I've tested it out too but without a result it didn't work sadly.

doru
  • 9,022
  • 2
  • 33
  • 43
Delusion
  • 1
  • 1
  • First, you have to go [through the basics](https://www.w3schools.com/css/) Please fullfill it, this question can be resolved in a tutorial. – Foo Bar Jun 02 '17 at 12:08
  • What is it you want to achieve? You need to be more specific in your question. Also, why are your 'width' and 'height' empty? – Rubenxfd Jun 02 '17 at 12:08
  • 1
    1. Why are all the pixel values missing. 2. What is your actual question and problem - it is very unclear what you have attempted to do and what is not working about it. Please take a tour of the [help centre](http://stackoverflow.com/help) to see [how to ask a good question](http://stackoverflow.com/help/how-to-ask). Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. – Pete Jun 02 '17 at 12:10
  • Possible duplicate of [Position Relative vs Position Absolute?](https://stackoverflow.com/questions/10426497/position-relative-vs-position-absolute) – Nimish Jun 02 '17 at 12:10

5 Answers5

0

if you set,

position : absolute

you can use left : value; right : value; top : value; bottom : value;

to change your block position .

if its relative , you can use margin : instead

Mohideen bin Mohammed
  • 18,813
  • 10
  • 112
  • 118
0

you must set position:relative and then set right and top.

MDA
  • 113
  • 2
  • 10
0

You can use float: right. You should look up for how to position elements​ using float. Remember to <div style="clear:both"></div> after using two float div.

0

The top div must be relative.

And you can change or add: bottom, left, right and top values..

For exp. :

<div style="position:relative; width:100px; height:100px;background-color:#6d0808;">
  <div style="background-color:#d3d3d3; padding:10px; position:absolute; right: -62px; bottom: 15px; ">
    <p>This is a paragraph</p>
  </div>
</div>
0

First of all you have to be more specific for what you want. i wrote a simple style in here for you HTML

<div class="sample">
<p>This is a paragraph</p>
</div>

CSS

.sample{
  width:250px;
  height:250px;
  background:#000;
  position:absolute;
  right:100px;
}

.sample p{
  color:#fff;
  padding:10px;
}

if you want to learn about position property please visit https://www.w3schools.com/cssref/pr_class_position.asp

tsdln
  • 109
  • 8