1

I want my button to link to a html file I have and such. But it isn't inside the borders I set for p. Why is it doing this? When I enclose it in p it's still outside and when I put it outside p it's still beyond the border. I want the button to be at the bottom right inside the borders where the 'something something' (test words) are. What am I missing here? Also don't worry about the black circle next to the button, it's not there when the button is on the actual site.

<body>
<p class="news1">something something
<ul class="readmore">
<li><a href="#">read more</a></li>
</ul>
</p>    
<br>
</div>
</body>

And the css

p.news1 {
color: #f9a724;
text-align:left;
border-style: solid;
border-color: #f9a724;
word-wrap: break-word;
line-height: 100px;
margin-right:50px;
padding:10px;
margin-left:50px;
font-family:Lato-Light;
}

ul.readmore li a{
display: block;
position:absolute;
transition: .4s ease;
padding: 8px 25px;
color: #000000;
background: #f9a724;
text-decoration: none;
}

ul li a:hover{
color: #f9a724;
background: #000000;    
}

https://jsfiddle.net/4f6osawa

johan
  • 93
  • 1
  • 5

3 Answers3

1
ul.readmore li a{
  display: block;
  position:absolute;
    transition: .4s ease;
   padding: 8px 25px;
    color: #000000;
    background: #f9a724;
margin-top:-85px; margin-left:295px;
    text-decoration: none;
}
1

Try this in your css

ul {
    position: absolute;
    width: 100%;
    top: 85px;
    left: 35px;    
}

Working Demo

Praveen Raj
  • 1,014
  • 1
  • 8
  • 12
0

ul elements are not legally allowed inside p elements.

<div class="news1">
    <p>something something</p>
<ul class="readmore">
   <li><a href="#">read more</a></li>
</ul>
<br>
</div>

css

.news1 {
    color: #f9a724;
    text-align:left;
    border-style: solid;
   border-color: #f9a724;
    word-wrap: break-word;
    line-height: 100px;
    margin-right:50px;
    padding:10px;
    margin-left:50px;
    font-family:Lato-Light;
    }

ul.readmore li a{
      display: block;
      position:absolute;
        transition: .4s ease;
       padding: 8px 25px;
        color: #000000;
        background: #f9a724;
        text-decoration: none;
    }
ul li a:hover{
  color: #f9a724;
    background: #000000;

}

Demo

akash
  • 2,117
  • 4
  • 21
  • 32