Solved

While text-align is right padding-right does not affect,why?

Posted on 2016-09-28
4
35 Views
Last Modified: 2016-09-28
Hello,

I have a div and its css but padding-right does not affect,you can see its fiddle in this link:

https://jsfiddle.net/jamshidi/fj41mt5w/

Thanks for your help
0
Comment
Question by:MOSTAGHASSI
4 Comments
 
LVL 35

Expert Comment

by:Terry Woods
ID: 41819479
It seems that the width set to 100% adding padding to the right pushes the width of the div out to be larger than the viewport width.

See what it looks like now that I've added a border:
https://jsfiddle.net/85z6toqm/
0
 

Assisted Solution

by:CWareIndia
CWareIndia earned 250 total points
ID: 41819484
Add the following to your CSS to fix this.  

box-sizing: border-box;
1
 
LVL 3

Accepted Solution

by:
pradeep kumar earned 250 total points
ID: 41819548
just change the float to right or "box-sizing: border-box;" as suggest by cwareindia also good solution.

.article-detail-section-name{
	width:100%;
	height:auto;
	float:right;
	text-align:right;
	font-family:Tahoma;
	font-size:18px;
	padding-right:85px;
	margin-top:50px;

}

Open in new window

0
 

Author Closing Comment

by:MOSTAGHASSI
ID: 41819621
Thanks for both solutions.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question