Solved

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

Posted on 2016-09-28
4
29 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
logo getting cutoff on ipad 30 85
Remove 'disabled' attribute 6 27
Creating a slider 12 34
Printing a Google Form 2 7
Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now