Margins

⎡Designs of a Muse⎦« Layout Tutorials »
 
 
 Margins

Next up is margins!

Now margins are a nifty little thing that can work wonders for your layout. Say there's part of an image that you need to hide but don't want to bother photoshopping. A combination of hidden overflow and margins can magically make that part 'disappear'. Although this proces is a little complicated so we should probably do that another time.

Another use for margins is to 'bump' text away from the border. If you happen to have the border the same color as your background, well this won't matter too much, but if you want a border that stands out, having text right up to the edge would make it difficult to read and your layout will look very crowded.

Make two text boxes, one within another and make the inside box, the same color as your background.

Inside the < div > tags for the text box, simply add 'margins:__px;'. Where __ is replaced by how far from the edge you want your text to go.

You could also manually adjust the margins for top, right, bottom and left by having four px values instead.


margin:5px 10px 15px 1px;



 
 

To overlap textboxes, instead of a positive value you would use a negative px in the direction that you want to overlap. The more negative the value, the more it will overlap.


margin:-10px 10px 15px 1px;



 
   

 


S
C
R
O
L
L
Like this story? Give it an Upvote!
Thank you!

Comments

You must be logged in to comment
rolling-thunder #1
Chapter 8: Just a question before I try this out--
Does this work the same way for pictures?
Like if I was to make a horizontal scroll for pictures, would it work the same way as with boxes?
-xttran #2
Chapter 4: I'm still very confused on how to make a vertical scroll ;-; /sobs/
Rose_17 #3
Chapter 1: Hello !! May I ask? Because I've been trying to apply the borders but can't. Do I copy the code you provided to the source? or something else?
CaramelMilkTea98
#4
Chapter 6: Waiting for more tutorials authornim~ I've been wanting to try making a layout or something to make my story more interesting haha. Thank you so much for writing these^^