|
|
#1 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 286
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
CSS Question: creating borders...
__________________
When some wild-eyed, eight-foot-tall maniac grabs your neck, taps the back of your favorite head up against the barroom wall, and he looks you crooked in the eye and he asks you if you've paid your dues, well, you just stare that big sucker right back in the eye, and you remember what ol' Jack Burton always says at a time like that: "Have ya paid your dues, Jack?" "Yessir, the check is in the mail." |
|
|
|
|
|
#2 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,687
Karma: 3644259
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2
|
Our wiki as a good discussion on using Borders around a page paragraph. See http://wiki.mobileread.com/wiki/CSS#Boxes
Dale
__________________
Dale DePriest http://pages.suddenlink.net/dalede or http://daledepriest.wikispaces.com currently using an EZ Reader or a Literati or my iPad. |
|
|
|
|
Enthusiast
|
|
|
|
#3 | |
|
Staff to 4 Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,690
Karma: 2485828
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2,Black Astak PEz, K4NT(now Wifes)
|
Quote:
) come into playLook at Section 8 (box model) of CSS2 Your text including the <br /> needs to be inside the block
__________________
Using: Ubuntu(32 bit):Oneric,Precise and XPpro SP3, W7HP(64)- - Libre Office w/Writer2EPUB
|
|
|
|
|
|
|
#4 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 286
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
Like a jerk, i realized i hadn't actually attached an image... d'oh!
in the past, i've used: Code:
.border {
border-style: solid;
border-width: 3px;
padding-left: 5px;
padding-right: 5px;
padding-top: 2px;
padding-bottom: 2px;
}
To be clear, the image below is what I'm trying to achieve... not what I've actually achieved (the best I've been able to do is similar to the file attached by theducks.) EDIT: I think I see where I'm getting tripped up. I'm trying to get the left and right parts of the border to be defined by their proximity to the text, not by their proximity to the margins (since the distance between the two margins varies based on the screen size). Any ideas?
__________________
When some wild-eyed, eight-foot-tall maniac grabs your neck, taps the back of your favorite head up against the barroom wall, and he looks you crooked in the eye and he asks you if you've paid your dues, well, you just stare that big sucker right back in the eye, and you remember what ol' Jack Burton always says at a time like that: "Have ya paid your dues, Jack?" "Yessir, the check is in the mail." Last edited by ElMiko; 09-18-2012 at 02:21 PM. |
|
|
|
|
|
#5 | |
|
Staff to 4 Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,690
Karma: 2485828
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2,Black Astak PEz, K4NT(now Wifes)
|
Quote:
__________________
Using: Ubuntu(32 bit):Oneric,Precise and XPpro SP3, W7HP(64)- - Libre Office w/Writer2EPUB
|
|
|
|
|
|
|
#6 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,687
Karma: 3644259
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2
|
From the wiki
Values are calculated with reference to a width property, which if not specified defaults to the page width or the previous width. There are 'margin-width' and 'padding-width' properties which can be specified with length units or as a percentage. Auto is also allowed which is the same as not specifying a width. Dale
__________________
Dale DePriest http://pages.suddenlink.net/dalede or http://daledepriest.wikispaces.com currently using an EZ Reader or a Literati or my iPad. |
|
|
|
|
|
#7 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 286
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
I'd been trying to use your template, but percentages really just do the same thing as px or em... they define the border based on the proximity to the edge of the "page" not based on the proximity to the word. Whereas in the example i gave for a single line of text, three or four words long, where the style applied to a <span> within the <p> tags, the border is determined by its proximity to the text.
eg. <p><span class="border">Some Short Text</span></p> I've attached to images of the style (as i wrote it in my previous post) i used, in action. The first is when it works (single line, no breaks), the second is when it doesn't.
__________________
When some wild-eyed, eight-foot-tall maniac grabs your neck, taps the back of your favorite head up against the barroom wall, and he looks you crooked in the eye and he asks you if you've paid your dues, well, you just stare that big sucker right back in the eye, and you remember what ol' Jack Burton always says at a time like that: "Have ya paid your dues, Jack?" "Yessir, the check is in the mail." |
|
|
|
|
|
#8 | |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 286
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
Quote:
__________________
When some wild-eyed, eight-foot-tall maniac grabs your neck, taps the back of your favorite head up against the barroom wall, and he looks you crooked in the eye and he asks you if you've paid your dues, well, you just stare that big sucker right back in the eye, and you remember what ol' Jack Burton always says at a time like that: "Have ya paid your dues, Jack?" "Yessir, the check is in the mail." |
|
|
|
|
|
|
#9 |
|
Staff to 4 Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,690
Karma: 2485828
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2,Black Astak PEz, K4NT(now Wifes)
|
Why are you using a Span?
If you note my sample, I use a BR inside with no ill effects Or is it, that you want 2 boxes?
__________________
Using: Ubuntu(32 bit):Oneric,Precise and XPpro SP3, W7HP(64)- - Libre Office w/Writer2EPUB
|
|
|
|
|
|
#10 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 286
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
I apologize, I'm obviously not being clear. Your example uses margins that are determined by the borders of the page, so as you change the size of the page, the distance between the border and the text also changes. I want the border to be defined by it's proximity to the TEXT, as in the span-based example. If you expand or contract the window/page in your example, the size of the box changes. In contrast, the only way for a span-based border to change is if the size of the screen is smaller than the text in the line, otherwise, the border dimensions remain fixed, relative to the text.
__________________
When some wild-eyed, eight-foot-tall maniac grabs your neck, taps the back of your favorite head up against the barroom wall, and he looks you crooked in the eye and he asks you if you've paid your dues, well, you just stare that big sucker right back in the eye, and you remember what ol' Jack Burton always says at a time like that: "Have ya paid your dues, Jack?" "Yessir, the check is in the mail." |
|
|
|
|
|
#11 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,687
Karma: 3644259
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2
|
Quote:
Dale
__________________
Dale DePriest http://pages.suddenlink.net/dalede or http://daledepriest.wikispaces.com currently using an EZ Reader or a Literati or my iPad. |
|
|
|
|
|
|
#12 |
|
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,135
Karma: 2460081
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon
|
There's a conflict there, because normal block elements (a paragraph) have no "natural" width (the width of their contents), rather the contents are adapted to the container's width (the width of the page, minus margins etc.)
If you want the width of the element to be adapted to its contents, I'm afraid you have to use a table (you can "fake" it using display:table), an inline-block would work too, but it's not supported by the spec. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CSS/HTML question | ElMiko | Sigil | 54 | 10-23-2012 12:39 PM |
| CSS Question | jackibar | Sigil | 24 | 03-01-2012 09:12 AM |
| CSS question | crutledge | Workshop | 17 | 12-17-2011 07:52 AM |
| CSS Question | AppleTard | Calibre | 1 | 06-12-2011 12:07 AM |
| Question about creating columns | Jabby | Library Management | 17 | 02-08-2011 03:23 PM |